我希望看到fun let的源代码,但是在我按下ctrl键之后,我得到了以下内容.

如何在Android Studio 3.1.3中查看Kotlin的乐趣源代码?

@kotlin.internal.InlineOnly public inline fun <T, R> T.let(block: (T) -> R): R { /* compiled code */ }

Added Content

Added Content

Android studio start

And More

单击" Select 源"时的图像

kotlin jar image

Solved:

现在,当系统今天更新Kotlin插件时就可以了.

I think that the system update the plugin failed caused the problem.

如何手动更新插件?您知道,系统并不总是显示更新插件UI!

enter image description here

推荐答案

我可以在kotlin-stdlib-common-1.2.51.jar中看到let的源代码,路径是kotlin -> Standard.kt (or file name showing as StandardKt.kotlin_metadata).我也在执行同样的命令.

Below is code of that fun

/**
 * Calls the specified function [block] with `this` value as its argument and returns its result.
 */
@kotlin.internal.InlineOnly
public inline fun <T, R> T.let(block: (T) -> R): R {
    contract {
        callsInPlace(block, InvocationKind.EXACTLY_ONCE)
    }
    return block(this)
}

我使用的版本是

Android Studio 3.1.3
Build #AI-173.4819257, built on June 4, 2018
JRE: 1.8.0_152-release-1024-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6

And kotlin version is Version: 1.2.51-release-Studio3.1-1

Kotlin相关问答推荐

在kotlin中使用List(mylist. size){index—TODO()}或Map迭代>

为什么onEach不是挂起函数,而Collect是?

为什么Kotlin函数参数名会 destruct 方法调用?

如果启用了Flyway迁移,则不能具有配置属性';datources.default.架构-生成

Microronaut Data 4和JDbi

在Kotlin中的嵌套when语句中,else块是强制性的吗?

在 kotlin 中使具体化字段可选

Kotlin 可空泛型

Kotlin 中的as Long和.toLong()有什么区别?

在jetpack compose中将默认方向设置为横向?

添加 Kapt 插件后 - 执行 org.jetbrains.kotlin.gradle.internal.KaptExecution 时发生故障

Swift vs Kotlin 在排序数组上的表现

Anko 中的水平线性布局

如何在Spring Boot应用程序上启用承载身份验证?

大小写敏感性 Kotlin / ignoreCase

编译错误:-Xcoroutines has no effect: coroutines are enabled anyway in 1.3 and beyond

Kotlin - 是否可以在类中的 init 块之前初始化伴随对象?

保存对象时未填充 Spring Boot JPA@CreatedDate @LastModifiedDate

尾随 lambda 语法(Kotlin)的目的是什么?

比较Kotlin的NaN