diff options
author | Som Snytt <som.snytt@gmail.com> | 2012-08-23 11:25:01 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2012-09-01 08:50:55 -0700 |
commit | 6917599b9bb5a316e0ce9e63927dae8c0f09c861 (patch) | |
tree | 257d361f6d367fbdf90071bc074ffbb94bb006f2 /test/files | |
parent | 67de646839f664864a3eeb640973b62c44ffa016 (diff) | |
download | scala-6917599b9bb5a316e0ce9e63927dae8c0f09c861.tar.gz scala-6917599b9bb5a316e0ce9e63927dae8c0f09c861.tar.bz2 scala-6917599b9bb5a316e0ce9e63927dae8c0f09c861.zip |
SI-6278 fixed: synthetic implicit def must sort with its associated implicit class
Add a case to the ad-hoc (or add-hack) addSynthetics to keep the trees close.
This relies on naming convention, so changes in naming of the implicit def
would require an update here.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/pos/t6278-synth-def.scala | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/files/pos/t6278-synth-def.scala b/test/files/pos/t6278-synth-def.scala new file mode 100644 index 0000000000..b8b660fbe3 --- /dev/null +++ b/test/files/pos/t6278-synth-def.scala @@ -0,0 +1,30 @@ + +package t6278 + +import language.implicitConversions + +object test { + def ok() { + class Foo(val i: Int) { + def foo[A](body: =>A): A = body + } + implicit def toFoo(i: Int): Foo = new Foo(i) + + val k = 1 + k foo println("k?") + val j = 2 + } + def nope() { + implicit class Foo(val i: Int) { + def foo[A](body: =>A): A = body + } + + val k = 1 + k foo println("k?") + //lazy + val j = 2 + } + def main(args: Array[String]) { + ok(); nope() + } +} |