Open2
Kotlin1.5からkotlin.Result型が関数の戻り値に指定できるようになっていた
In Kotlin 1.3 till 1.5 this Result could not be used directly as a return type of Kotlin functions. This restriction was lifted in Kotlin 1.5
Result型が登場したKotlin1.3時点ではResult型を直接関数の戻り値にはできなかったが、1.5からこの制限がなくなった。
1.3時点での制限は現在のKEEPでは
Limitations (legacy)
のセクションで紹介されている。
fun getSomething(): Result<Something> // エラー
fun getSomethingList(): Result<List<Something>> // エラー
Result型を直接関数の戻り値にするとコンパイルエラーになる。publicなpropertyも同様。
1.5ではこれらの制限がなくなっている。