aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/Contexts.scala37
-rw-r--r--src/dotty/tools/dotc/core/Definitions.scala1
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala6
3 files changed, 24 insertions, 20 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala
index 15c7b4b11..206ef9d8b 100644
--- a/src/dotty/tools/dotc/core/Contexts.scala
+++ b/src/dotty/tools/dotc/core/Contexts.scala
@@ -177,26 +177,25 @@ object Contexts {
/** The new implicit references that are introduced by this scope */
private var implicitsCache: ContextualImplicits = null
def implicits: ContextualImplicits = {
- if (implicitsCache == null ) {
- val outerImplicits =
- if (isImportContext && importInfo.hiddenRoot.exists)
- outer.implicits exclude importInfo.hiddenRoot
- else
- outer.implicits
- try
- implicitsCache = {
- val implicitRefs: List[TermRef] =
- if (isClassDefContext) owner.thisType.implicitMembers
- else if (isImportContext) importInfo.importedImplicits
- else if (isNonEmptyScopeContext) scope.implicitDecls
- else Nil
- if (implicitRefs.isEmpty) outerImplicits
- else new ContextualImplicits(implicitRefs, outerImplicits)(this)
- }
- catch {
- case ex: CyclicReference => implicitsCache = outerImplicits
+ if (implicitsCache == null )
+ implicitsCache = {
+ val implicitRefs: List[TermRef] =
+ if (isClassDefContext)
+ try owner.thisType.implicitMembers
+ catch {
+ case ex: CyclicReference => Nil
+ }
+ else if (isImportContext) importInfo.importedImplicits
+ else if (isNonEmptyScopeContext) scope.implicitDecls
+ else Nil
+ val outerImplicits =
+ if (isImportContext && importInfo.hiddenRoot.exists)
+ outer.implicits exclude importInfo.hiddenRoot
+ else
+ outer.implicits
+ if (implicitRefs.isEmpty) outerImplicits
+ else new ContextualImplicits(implicitRefs, outerImplicits)(this)
}
- }
implicitsCache
}
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala
index 7ed0a26e0..502b42987 100644
--- a/src/dotty/tools/dotc/core/Definitions.scala
+++ b/src/dotty/tools/dotc/core/Definitions.scala
@@ -326,6 +326,7 @@ class Definitions {
lazy val Product_productArity = ProductClass.requiredMethod(nme.productArity)
lazy val Product_productPrefix = ProductClass.requiredMethod(nme.productPrefix)
lazy val LanguageModuleClass = ctx.requiredModule("dotty.language").moduleClass.asClass
+ lazy val NonLocalReturnControlClass = ctx.requiredClass("scala.runtime.NonLocalReturnControl")
// Annotation base classes
lazy val AnnotationClass = ctx.requiredClass("scala.annotation.Annotation")
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 985d1a9c7..2ce2b8d20 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -299,7 +299,11 @@ object SymDenotations {
/** The expanded name of this denotation. */
final def expandedName(implicit ctx: Context) =
if (is(ExpandedName) || isConstructor) name
- else name.expandedName(initial.asSymDenotation.owner)
+ else {
+ def legalize(name: Name): Name = // JVM method names may not contain `<' or `>' characters
+ if (is(Method)) name.replace('<', '(').replace('>', ')') else name
+ legalize(name.expandedName(initial.asSymDenotation.owner))
+ }
// need to use initial owner to disambiguate, as multiple private symbols with the same name
// might have been moved from different origins into the same class