-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implicit class with eponymous type parameter does not compile #7033
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7033?orig=1 |
@retronym said (edited on Jan 28, 2013 12:51:11 PM UTC): scala> ticket/7033 ~/code/scala2 git diff
diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
index acc4f7f..b314d1c 100644
--- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
@@ -389,7 +389,7 @@ trait MethodSynthesis {
result
}
def derivedTree: DefDef =
- factoryMeth(mods & flagsMask | flagsExtra, name, tree, symbolic = false)
+ factoryMeth(mods & flagsMask | flagsExtra, name, tree, symbolic = true)
def flagsExtra: Long = METHOD | IMPLICIT | SYNTHETIC
def flagsMask: Long = AccessFlags
def name: TermName = tree.name.toTermName
scala> implicit class X(val x: Any)
scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving module $iw
at scala.reflect.internal.Symbols$Symbol$$anonfun$info$3.apply(Symbols.scala:1210)
at scala.reflect.internal.Symbols$Symbol$$anonfun$info$3.apply(Symbols.scala:1208)
at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.reflect.internal.Symbols$Symbol.lock(Symbols.scala:478)
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1208)
at scala.reflect.internal.Symbols$Symbol.tpe(Symbols.scala:1192)
at scala.reflect.internal.Symbols$Symbol.tpeHK(Symbols.scala:1193)
at scala.reflect.internal.Types$Type.computeMemberType(Types.scala:782)
at scala.reflect.internal.Types$Type.memberType(Types.scala:779)
at scala.reflect.internal.Types$class.defineUnderlyingOfSingleType(Types.scala:1524)
at scala.reflect.internal.SymbolTable.defineUnderlyingOfSingleType(SymbolTable.scala:13)
at scala.reflect.internal.Types$SingleType.underlying(Types.scala:1476)
at scala.reflect.internal.Types$SingletonType.widen(Types.scala:1330)
at scala.reflect.internal.Types$SingletonType.widen(Types.scala:1330)
at scala.reflect.internal.Types$AsSeenFromMap.toPrefix$1(Types.scala:4518)
at scala.reflect.internal.Types$AsSeenFromMap.apply(Types.scala:4533)
at scala.reflect.internal.Types$TypeMap.mapOver(Types.scala:4160)
at scala.reflect.internal.Types$AsSeenFromMap.apply(Types.scala:4615)
at scala.reflect.internal.Types$Type.asSeenFrom(Types.scala:752)
at scala.reflect.internal.Types$Type.computeMemberType(Types.scala:786)
at scala.reflect.internal.Types$Type.memberType(Types.scala:779)
at scala.reflect.internal.TreeGen.mkAttributedSelect(TreeGen.scala:184)
at scala.reflect.internal.TreeGen.mkAttributedRef(TreeGen.scala:124)
at scala.reflect.internal.TreeGen.mkAttributedRef(TreeGen.scala:130)
at scala.tools.nsc.ast.TreeDSL$CODE$.REF(TreeDSL.scala:307)
at scala.tools.nsc.typechecker.Unapplies$class.classType(Unapplies.scala:83)
at scala.tools.nsc.typechecker.Unapplies$class.classtpe$1(Unapplies.scala:139)
at scala.tools.nsc.typechecker.Unapplies$class.factoryMeth(Unapplies.scala:141)
at scala.tools.nsc.interpreter.ReplGlobal$$anon$1.factoryMeth(ReplGlobal.scala:24)
at scala.tools.nsc.typechecker.MethodSynthesis$MethodSynth$ImplicitClassWrapper.derivedTree(MethodSynthesis.scala:392)
<console>:7: error: illegal cyclic reference involving object $iw
implicit class X(val x: Any)
^
<console>:12: error: illegal inheritance;
self-type type does not conform to scala.AnyRef's selftype AnyRef
}
^ |
@retronym said: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: