Skip to content

Commit ce6a47b

Browse files
authored
Merge pull request #12763 from dotty-staging/fix-#12754
Add regression test
2 parents 662060d + 5877cc7 commit ce6a47b

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

tests/neg/i12754.scala

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
transparent inline def transform(inline a: Any): Any = inline a match {
2+
case x: Byte => x
3+
case x: Short => x
4+
case x: Int => x
5+
case x: Long => x
6+
case x: Float => x
7+
case x: Double => x
8+
case _ => a
9+
}
10+
11+
inline def lt(inline a: Any, inline b: Double): Boolean = transform(a) < b // error
12+
13+
def test = {
14+
println(lt(0, 5))
15+
}

tests/pos/i12754.scala

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
transparent inline def transform(inline a: Any): Any = inline a match {
2+
case x: Byte => x
3+
case x: Short => x
4+
case x: Int => x
5+
case x: Long => x
6+
case x: Float => x
7+
case x: Double => x
8+
case _ => a
9+
}
10+
11+
def test = {
12+
println(transform(0) < 5)
13+
}

0 commit comments

Comments
 (0)