diff options
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/Definitions.scala | 2 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/StdNames.scala | 1 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/parsing/SymbolicXMLBuilder.scala | 1 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Typer.scala | 5 | ||||
-rw-r--r-- | tests/pos/i1976.scala | 4 |
5 files changed, 12 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index 2797bb8a6..01a164a81 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -527,6 +527,8 @@ class Definitions { lazy val EqType = ctx.requiredClassRef("scala.Eq") def EqClass(implicit ctx: Context) = EqType.symbol.asClass + lazy val XMLTopScopeModuleRef = ctx.requiredModuleRef("scala.xml.TopScope") + // Annotation base classes lazy val AnnotationType = ctx.requiredClassRef("scala.annotation.Annotation") def AnnotationClass(implicit ctx: Context) = AnnotationType.symbol.asClass diff --git a/compiler/src/dotty/tools/dotc/core/StdNames.scala b/compiler/src/dotty/tools/dotc/core/StdNames.scala index 4a9c50dad..c424c6182 100644 --- a/compiler/src/dotty/tools/dotc/core/StdNames.scala +++ b/compiler/src/dotty/tools/dotc/core/StdNames.scala @@ -533,6 +533,7 @@ object StdNames { val nullRuntimeClass: N = "scala.runtime.Null$" val synthSwitch: N = "$synthSwitch" + val _scope: N = "$scope" // unencoded operators object raw { diff --git a/compiler/src/dotty/tools/dotc/parsing/SymbolicXMLBuilder.scala b/compiler/src/dotty/tools/dotc/parsing/SymbolicXMLBuilder.scala index 20b655a19..09d1b20b1 100644 --- a/compiler/src/dotty/tools/dotc/parsing/SymbolicXMLBuilder.scala +++ b/compiler/src/dotty/tools/dotc/parsing/SymbolicXMLBuilder.scala @@ -55,7 +55,6 @@ class SymbolicXMLBuilder(parser: Parser, preserveWS: Boolean)(implicit ctx: Cont val _buf: TermName = "$buf" val _md: TermName = "$md" val _plus: TermName = "$amp$plus" - val _scope: TermName = "$scope" val _tmpscope: TermName = "$tmpscope" val _xml: TermName = "xml" } diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index ded8993fb..52f0a7ec7 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -351,6 +351,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit val ownType = if (rawType.exists) ensureAccessible(rawType, superAccess = false, tree.pos) + else if (name == nme._scope) { + // gross hack to support current xml literals. + // awaiting a better implicits based solution for library-supported xml + return ref(defn.XMLTopScopeModuleRef) + } else errorType(new MissingIdent(tree, kind, name.show), tree.pos) diff --git a/tests/pos/i1976.scala b/tests/pos/i1976.scala new file mode 100644 index 000000000..32967977d --- /dev/null +++ b/tests/pos/i1976.scala @@ -0,0 +1,4 @@ +object Test { + import scala.xml._ + val node = <node>{ "whatever " }</node> +} |