Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit defe9ab

Browse files
authoredApr 15, 2019
Merge pull request #6308 from dotty-staging/fix-4863
Fix #4863: Add tests
2 parents c9b4436 + ebfb238 commit defe9ab

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
 

‎tests/neg/i4863.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
sealed trait Nat
2+
case class S(n: Nat) extends Nat
3+
case object Z extends Nat
4+
5+
inline def pred(n: Nat) = inline n match {
6+
case S(m) => m
7+
case Z =>
8+
compiletime.error("n cannot be Z")
9+
}
10+
11+
class Test {
12+
pred(Z) // error
13+
}

‎tests/pos/i4863.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
sealed trait Nat
2+
case class S(n: Nat) extends Nat
3+
case object Z extends Nat
4+
5+
inline def pred(n: Nat) = inline n match {
6+
case S(m) => m
7+
case Z =>
8+
compiletime.error("n cannot be Z")
9+
}
10+
11+
class Test {
12+
pred(S(Z))
13+
}

0 commit comments

Comments
 (0)
Please sign in to comment.