We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a4f2671 + 0aefc4f commit e599efbCopy full SHA for e599efb
tests/pos/i11631.scala
@@ -0,0 +1,19 @@
1
+trait MyTrait:
2
+ def a(): String = ""
3
+
4
+class Nul
5
6
+extension [T](x: T | Nul) inline def nnn: x.type & T = ???
7
8
+class MyClass:
9
+ var myTrait: MyTrait|Null = null
10
11
+ def printA(): Unit = println(myTrait.nnn.a())
12
13
+@main def runTest(): Unit =
14
+ val mt = new MyTrait:
15
+ override def a(): String = "hello world"
16
17
+ val mc = MyClass()
18
+ mc.myTrait = mt
19
+ mc.printA()
tests/pos/i11631b.scala
@@ -0,0 +1,15 @@
+ def printA(): Unit = println(myTrait.nn.a())
0 commit comments