diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/Types.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Types.scala | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index 5ec350c35f..428bdb3ab6 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -122,6 +122,13 @@ trait Types requires SymbolTable { /** Is this type produced as a repair for an error? */ def isError: boolean = symbol.isError; + /** Is this type produced as a repair for an error? */ + def isErroneous: boolean = { + ErroneousTraverser.result = false; + ErroneousTraverser.traverse(this); + ErroneousTraverser.result + } + /** Does this type denote a stable reference (i.e. singleton type)? */ def isStable: boolean = false; @@ -1340,6 +1347,18 @@ trait Types requires SymbolTable { } } + /** A map to implement the contains method */ + object ErroneousTraverser extends TypeTraverser { + var result: boolean = _; + def traverse(tp: Type): TypeTraverser = { + if (!result) { + result = tp.isError + mapOver(tp) + } + this + } + } + /** A map to compute the most deeply nested owner that contains all the symbols * of thistype or prefixless typerefs/singletype occurrences in given type */ object commonOwnerMap extends TypeMap { |