https://kotlinlang.org logo
#random
Title
# random
c

cedric

04/20/2017, 12:53 AM
@mg6maciej Surprisingly, the compiler is not flagging this as “will always be `false`”
m

mg6maciej

04/20/2017, 2:31 AM
You never know. There might be an alternative universe where this is actually always true.
b

bamdmux

04/20/2017, 5:36 AM
The universe where all languages are untyped. Not the most efficient of the universes...
m

miha-x64

04/20/2017, 7:43 AM
x is Class1 && x is Class2
should be an error.
m

mg6maciej

04/20/2017, 9:09 AM
Not when
open class Class2 && class Class1 : Class2
😉
Could be a warning tho.
c

cedric

04/20/2017, 2:32 PM
@miha-x64 Why would it be an error?
Copy code
interface A {}
    interface B {}
    class Z : A,B

    val a: Z? = null
    val b = a is A && a is B
m

mg6maciej

04/20/2017, 2:33 PM
@miha-x64 specifically mentioned 2 classes.
For interfaces it's cool. Kinda quasimodo-union types.
2 Views