Skip to content

Commit 7d34d28

Browse files
committed
Fix scala#1443: Replace toplevel TypeBounds with Any
1 parent 62348de commit 7d34d28

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,12 @@ object Parsers {
652652
*/
653653
def toplevelTyp(): Tree = {
654654
val t = typ()
655-
for (wildcardPos <- findWildcardType(t)) syntaxError("unbound wildcard type", wildcardPos)
656-
t
655+
findWildcardType(t) match {
656+
case Some(wildcardPos) =>
657+
syntaxError("unbound wildcard type", wildcardPos)
658+
Ident(Names.typeName("Any")).withPos(t.pos)
659+
case None => t
660+
}
657661
}
658662

659663
/** Type ::= FunArgTypes `=>' Type

tests/pending/neg/unboundWildcard.scala renamed to tests/neg/unboundWildcard.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
object unboundWildcard {
22

3-
// TODO: move this to tests/neg once it doesn't crash the compiler anymore
43
val wildcardVal: _ = 0 // error: unbound wildcard type
54

65
val annotated: _ @unchecked = 0 // error: unbound wildcard type

0 commit comments

Comments
 (0)