diff options
Diffstat (limited to 'src/dotty/tools/dotc/parsing/Parsers.scala')
-rw-r--r-- | src/dotty/tools/dotc/parsing/Parsers.scala | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/parsing/Parsers.scala b/src/dotty/tools/dotc/parsing/Parsers.scala index 12f629c57..edc9d3f66 100644 --- a/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/src/dotty/tools/dotc/parsing/Parsers.scala @@ -648,12 +648,17 @@ object Parsers { } /* ------------- TYPES ------------------------------------------------------ */ - /** Same as [[typ]], but emits a syntax error if it returns a wildcard. + /** Same as [[typ]], but if this results in a wildcard it emits a syntax error and + * returns a tree for type `Any` instead. */ def toplevelTyp(): Tree = { val t = typ() - for (wildcardPos <- findWildcardType(t)) syntaxError("unbound wildcard type", wildcardPos) - t + findWildcardType(t) match { + case Some(wildcardPos) => + syntaxError("unbound wildcard type", wildcardPos) + scalaAny + case None => t + } } /** Type ::= FunArgTypes `=>' Type |