Make CharSequence.length a function instead of property
And String.length as well. This is done for JVM interoperability: java.lang.CharSequence is an open class and has a function 'length()' which should be implemented in subclasses somehow. A minor unexpected effect of this is that String.length() is now a compile-time constant (it wasn't such as a property because properties are not supported in compile-time constant evaluation) #KT-3571 Fixed
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
== test ==
|
||||
fun test(s: String?) {
|
||||
s?.length
|
||||
fun test(s: IntProgression?) {
|
||||
s?.start
|
||||
}
|
||||
---------------------
|
||||
<v0>: {<: String?} NEW: magic[FAKE_INITIALIZER](s: String?) -> <v0>
|
||||
s <v1>: {<: CharSequence?} NEW: r(s) -> <v1>
|
||||
length <v2>: * NEW: r(length|<v1>) -> <v2>
|
||||
s?.length <v2>: * COPY
|
||||
{ s?.length } <v2>: * COPY
|
||||
<v0>: {<: IntProgression?} NEW: magic[FAKE_INITIALIZER](s: IntProgression?) -> <v0>
|
||||
s <v1>: {<: Progression<Int>?} NEW: r(s) -> <v1>
|
||||
start <v2>: * NEW: r(start|<v1>) -> <v2>
|
||||
s?.start <v2>: * COPY
|
||||
{ s?.start } <v2>: * COPY
|
||||
=====================
|
||||
|
||||
Reference in New Issue
Block a user