We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 66e83b4 commit 0e50082Copy full SHA for 0e50082
tests/explicit-nulls/neg/flow-implicitly.scala
@@ -0,0 +1,10 @@
1
+
2
+// Test that flow typing works well with implicit resolution.
3
+class Test {
4
+ implicit val x: String | Null = ???
5
+ implicitly[x.type <:< String] // error: x.type is widened String|Null
6
7
+ if (x != null) {
8
+ implicitly[x.type <:< String] // ok: x.type is widened to String
9
+ }
10
+}
tests/explicit-nulls/pos/flow-singleton.scala
@@ -0,0 +1,9 @@
+// Test that flow typing works well with singleton types.
+ val x : String | Null = ???
+ val y: x.type = x
+ y.toLowerCase // ok: y should have type `String` in this branch
0 commit comments