File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -1077,15 +1077,15 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1077
1077
}
1078
1078
1079
1079
def typedAndTypeTree (tree : untpd.AndTypeTree )(implicit ctx : Context ): AndTypeTree = track(" typedAndTypeTree" ) {
1080
- val left1 = typed(tree.left)
1081
- val right1 = typed(tree.right)
1080
+ val left1 = checkSimpleKinded( typed(tree.left) )
1081
+ val right1 = checkSimpleKinded( typed(tree.right) )
1082
1082
assignType(cpy.AndTypeTree (tree)(left1, right1), left1, right1)
1083
1083
}
1084
1084
1085
1085
def typedOrTypeTree (tree : untpd.OrTypeTree )(implicit ctx : Context ): OrTypeTree = track(" typedOrTypeTree" ) {
1086
1086
val where = " in a union type"
1087
- val left1 = checkNotSingleton(typed(tree.left), where)
1088
- val right1 = checkNotSingleton(typed(tree.right), where)
1087
+ val left1 = checkNotSingleton(checkSimpleKinded( typed(tree.left) ), where)
1088
+ val right1 = checkNotSingleton(checkSimpleKinded( typed(tree.right) ), where)
1089
1089
assignType(cpy.OrTypeTree (tree)(left1, right1), left1, right1)
1090
1090
}
1091
1091
Original file line number Diff line number Diff line change
1
+ object UnionTypes {
2
+ trait List [A ]
3
+ class Empty () extends List [Nothing ]
4
+ class Cons [A ](h : A , t : List [A ]) extends List [A ]
5
+
6
+ def test : Unit = {
7
+ val list : Cons | Empty = null // error: missing type parameter
8
+ val list2 : Empty & Cons = ??? // error: missing type parameter
9
+ }
10
+ }
You can’t perform that action at this time.
0 commit comments