Skip to content

Commit 6d0817d

Browse files
Merge pull request #12191 from dotty-staging/fix-#12180
Add regression test
2 parents bb806c5 + 8aa7c96 commit 6d0817d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

tests/pos/i12180a.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
inline def n = null
2+
inline def f = inline if n == null then 0 else 1
3+
inline def m = inline n match { case null => 0; case _ => 1 }
4+
5+
@main def main =
6+
println(f) // error
7+
println(m)

tests/pos/i12180b.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
inline def n = "im a string"
2+
inline def f = inline if n == null then 0 else 1
3+
inline def g = inline if null == n then 0 else 1
4+
inline def m = inline n match { case null => 0; case _ => 1 }
5+
6+
@main def main =
7+
println(f)
8+
println(g)
9+
println(m)

0 commit comments

Comments
 (0)