summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2009-08-21 17:23:12 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2009-08-21 17:23:12 +0000
commit4a1b8bcc729e7817aa4017a7494f2c61fd7b7a22 (patch)
treef548d7ccee4cf56db3f3ab17d435a064257c91f9 /src/compiler
parent163e4275ce6479fec2a04edac25e94cc176b8430 (diff)
downloadscala-4a1b8bcc729e7817aa4017a7494f2c61fd7b7a22.tar.gz
scala-4a1b8bcc729e7817aa4017a7494f2c61fd7b7a22.tar.bz2
scala-4a1b8bcc729e7817aa4017a7494f2c61fd7b7a22.zip
in the end had to disable conforms as view in t...
in the end had to disable conforms as view in tryImplicit (see comment in removeNames in NamesDefaults) fixed check file for viewtest added newTermName for conforms to StdNames, so removed the previous weirdness
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala1
-rw-r--r--src/compiler/scala/tools/nsc/symtab/StdNames.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala6
4 files changed, 7 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index 0f6fd6a944..1a7ca0294d 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -112,6 +112,7 @@ trait Definitions {
appliedType(ClassClass.tpe, List(classType))
else ClassClass.tpe
def Predef_error = getMember(PredefModule, nme.error)
+ def Predef_conforms = getMember(PredefModule, nme.conforms)
lazy val ConsoleModule: Symbol = getModule("scala.Console")
lazy val ScalaRunTimeModule: Symbol = getModule("scala.runtime.ScalaRunTime")
def SeqFactory = getMember(ScalaRunTimeModule, nme.Seq)
diff --git a/src/compiler/scala/tools/nsc/symtab/StdNames.scala b/src/compiler/scala/tools/nsc/symtab/StdNames.scala
index 885af91fdb..f3aa58f0ed 100644
--- a/src/compiler/scala/tools/nsc/symtab/StdNames.scala
+++ b/src/compiler/scala/tools/nsc/symtab/StdNames.scala
@@ -270,6 +270,7 @@ trait StdNames {
val canEqual_ = newTermName("canEqual")
val checkInitialized = newTermName("checkInitialized")
val classOf = newTermName("classOf")
+ val conforms = newTermName("conforms")
val copy = newTermName("copy")
val dottype = newTermName(".type")
val drop = newTermName("drop")
@@ -402,9 +403,6 @@ trait StdNames {
// Stores Java annotations on parameters with RetentionPolicy.RUNTIME
val RuntimeParamAnnotationATTR = newTermName("RuntimeVisibleParameterAnnotations")
val ScalaATTR = newTermName("Scala")
-
- newTermName("utterweirdness") // (adriaan) removed newTermName("identity"),
- // but if I don't give something in return, quick.lib (after newstarr) fails with "error: not found: value Nil"
}
def encode(str: String): Name = newTermName(NameTransformer.encode(str))
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index bce3c4a5ee..4fc19182ef 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -420,8 +420,8 @@ self: Analyzer =>
*/
def tryImplicit(info: ImplicitInfo): SearchResult =
if (containsError(info.tpe) ||
- (isLocal && shadowed.contains(info.name)) //||
- // (isView && (info.sym == Predef_identity || info.sym == Predef_conforms})) //@M this condition prevents no-op conversions, which are a problem (besides efficiency),
+ (isLocal && shadowed.contains(info.name)) ||
+ (isView && (info.sym == Predef_conforms)) //@M this condition prevents no-op conversions, which are a problem (besides efficiency),
// one example is removeNames in NamesDefaults, which relies on the type checker failing in case of ambiguity between an assignment/named arg
) SearchFailure
else typedImplicit(info)
diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
index 9d485cc730..d86c9f3b44 100644
--- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
@@ -390,12 +390,12 @@ trait NamesDefaults { self: Analyzer =>
argPos(index) = pos
rhs
case t: Tree =>
- //@M was: errorTree(arg, ...)
// this throws an exception that's caught in `tryTypedApply` (as it uses `silent`)
// unfortunately, tryTypedApply recovers from the exception if you use errorTree(arg, ...) and conforms is allowed as a view (see tryImplicit in Implicits)
// because it tries to produce a new qualifier (if the old one was P, the new one will be conforms.apply(P)), and if that works, it pretends nothing happened
- // so, to make sure tryTypedApply fails, pass EmptyTree instead
- errorTree(EmptyTree, "reference to "+ name +" is ambiguous; it is both, a parameter\n"+
+ // so, to make sure tryTypedApply fails, would like to pass EmptyTree instead of arg, but can't do that because eventually setType(ErrorType) is called, and EmptyTree only accepts NoType as its tpe
+ // thus, we need to disable conforms as a view...
+ errorTree(arg, "reference to "+ name +" is ambiguous; it is both, a parameter\n"+
"name of the method and the name of a variable currently in scope.")
}
//@M note that we don't get here when an ambiguity was detected (during the computation of res),