We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7100529 commit 2cca082Copy full SHA for 2cca082
tests/pos/i13197.scala
@@ -0,0 +1,12 @@
1
+// this test is similar to explicit-nulls/pos/i13197.scala, but without explicit nulls
2
+
3
+extension [T](x: T | String) inline def forceString: x.type & String =
4
+ x.asInstanceOf
5
6
+trait Bar:
7
+ def b: String | Int
8
9
+class Foo(a: String = "", b: Any)
10
11
+object Foo:
12
+ def foo(bar: Bar) = Foo(b = bar.b.forceString)
0 commit comments