Skip to content

Commit fa919f5

Browse files
committed
add transitivity test
1 parent 3202767 commit fa919f5

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class CompilationTests {
5252
compileFile("tests/pos-special/notNull.scala", defaultOptions.and("-Yexplicit-nulls")),
5353
compileDir("tests/pos-special/adhoc-extension", defaultOptions.and("-source", "3.1", "-feature", "-Xfatal-warnings")),
5454
compileFile("tests/pos-special/i7575.scala", defaultOptions.andLanguageFeature("dynamics")),
55+
compileFile("tests/pos-special/i10511-transitivity.scala", defaultOptions), // avoid pickling test
5556
compileFile("tests/pos-special/kind-projector.scala", defaultOptions.and("-Ykind-projector")),
5657
compileFile("tests/run/i5606.scala", defaultOptions.and("-Yretain-trees")),
5758
compileFile("tests/pos-custom-args/i5498-postfixOps.scala", defaultOptions withoutLanguageFeature "postfixOps"),
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
enum Bool {
2+
case True
3+
case False
4+
}
5+
6+
import Bool._
7+
8+
type Not[B <: Bool] = B match {
9+
case True.type => False.type
10+
case False.type => True.type
11+
}
12+
13+
val t: True.type = True
14+
val f: False.type = False
15+
16+
val t1: Not[f.type] = t // transitivity
17+
val f1: Not[t.type] = f // transitivity
18+
19+
val t2: Not[f1.type] = t1 // transitivity x2
20+
val f2: Not[t1.type] = f1 // transitivity x2

0 commit comments

Comments
 (0)