diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-01-28 14:10:48 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-02-02 02:17:35 +0100 |
commit | 3af838c55674c0d03e8849d8c756d6ad56c537db (patch) | |
tree | 33fe0405a7b52bfd5d08cd809ff6b403d94e3c40 /test/files | |
parent | 02963d724c512251ce66502226408091686989ee (diff) | |
download | scala-3af838c55674c0d03e8849d8c756d6ad56c537db.tar.gz scala-3af838c55674c0d03e8849d8c756d6ad56c537db.tar.bz2 scala-3af838c55674c0d03e8849d8c756d6ad56c537db.zip |
SI-7033 Be symful when creating factory methods.
Implicit class factory methods were synthesizing the
reference to the class as `Ident(classDef.name)`, which
was unhygienic in case of `implicit class X[X]`.
To use symbols without causing a cycle, I switched from
`REF(symbol)` to `Ident(symbol)`. The former calls into:
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)
which forces the info of enclosing module and forms a cycle.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/pos/t7033.scala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/files/pos/t7033.scala b/test/files/pos/t7033.scala new file mode 100644 index 0000000000..a4d256673b --- /dev/null +++ b/test/files/pos/t7033.scala @@ -0,0 +1,15 @@ +import language.higherKinds +object Wrap { + implicit class X[X](val a: X) + + X[Int](0) +} + +class Wrap { + implicit class Y[Y](val a: Y) + Y[Int](0) + implicit class Z[Z[_]](val a: Z[Wrap.this.Z[Z]]) + Z[List](List(new Z[List](null))) +} + +case class X[X](val a: X) |