summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-06-20 11:39:47 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-07-05 15:51:28 -0700
commit4340f799da2c7a7097eb327c353d0d96084197f8 (patch)
tree3054df65ce7ed66bb2911a70795d57a734e8c2d3 /src/compiler/scala/tools/nsc/typechecker/Contexts.scala
parentb672009b43f6cbfd8cb22402f4f40b9201157e23 (diff)
downloadscala-4340f799da2c7a7097eb327c353d0d96084197f8.tar.gz
scala-4340f799da2c7a7097eb327c353d0d96084197f8.tar.bz2
scala-4340f799da2c7a7097eb327c353d0d96084197f8.zip
Spin off src/library/scala/xml to src/xml/scala/xml.
Summary: - Remove the last vestiges of xml from Predef and Contexts. - Change build to compile scala.xml to scala-xml.jar. - Deploy scala-xml module to maven. - Update partest accordingly. Note: An older compiler cannot use the new standard library to compile projects that use XML. Thus, skipping locker will break the build until we use 2.11.0-M4 for STARR. In the future build process, where we drop locker, we would have to release a milestone that supports the old and the new approach to xml. As soon as we'd be using that new milestone for starr, we could drop support for the old approach.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Contexts.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 1f4ff7cc2d..1f8f13ae02 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -99,22 +99,13 @@ trait Contexts { self: Analyzer =>
// there must be a scala.xml package when xml literals were parsed in this unit
if (unit.hasXml && ScalaXmlPackage == NoSymbol)
- unit.error(unit.firstXmlPos, "XML literals may only be used if the package scala.xml is present in the compilation classpath.")
-
- // TODO: remove the def below and drop `|| predefDefinesDollarScope` in the condition for `contextWithXML`
- // as soon as 2.11.0-M4 is released and used as STARR (and $scope is no longer defined in Predef)
- // Until then, to allow compiling quick with pre-2.11.0-M4 STARR,
- // which relied on Predef defining `val $scope`, we've left it in place.
- // Since the new scheme also imports $scope (as an alias for scala.xml.TopScope),
- // we must check whether it is still there and not import the alias to avoid ambiguity.
- // (All of this is only necessary to compile the full quick stage with STARR.
- // if using locker, Predef.$scope is no longer needed.)
- def predefDefinesDollarScope = definitions.getMemberIfDefined(PredefModule, nme.dollarScope) != NoSymbol
-
- // hack for the old xml library (detected by looking for scala.xml.TopScope, which needs to be in scope as $scope)
- // import scala.xml.{TopScope => $scope}
+ unit.error(unit.firstXmlPos, "To compile XML syntax, the scala.xml package must be on the classpath.\nPlease see https://github.com/scala/scala/wiki/Scala-2.11#xml.")
+
+ // scala-xml needs `scala.xml.TopScope` to be in scope globally as `$scope`
+ // We detect `scala-xml` by looking for `scala.xml.TopScope` and
+ // inject the equivalent of `import scala.xml.{TopScope => $scope}`
val contextWithXML =
- if (!unit.hasXml || ScalaXmlTopScope == NoSymbol || predefDefinesDollarScope) rootImportsContext
+ if (!unit.hasXml || ScalaXmlTopScope == NoSymbol) rootImportsContext
else rootImportsContext.make(gen.mkImport(ScalaXmlPackage, nme.TopScope, nme.dollarScope))
val c = contextWithXML.make(tree, unit = unit)