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
10771077 }
10781078
10791079 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) )
10821082 assignType(cpy.AndTypeTree (tree)(left1, right1), left1, right1)
10831083 }
10841084
10851085 def typedOrTypeTree (tree : untpd.OrTypeTree )(implicit ctx : Context ): OrTypeTree = track(" typedOrTypeTree" ) {
10861086 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)
10891089 assignType(cpy.OrTypeTree (tree)(left1, right1), left1, right1)
10901090 }
10911091
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