aboutsummaryrefslogtreecommitdiff
path: root/tests/untried/pos/t6278-synth-def.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/untried/pos/t6278-synth-def.scala')
-rw-r--r--tests/untried/pos/t6278-synth-def.scala30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/untried/pos/t6278-synth-def.scala b/tests/untried/pos/t6278-synth-def.scala
new file mode 100644
index 000000000..a1c93fca8
--- /dev/null
+++ b/tests/untried/pos/t6278-synth-def.scala
@@ -0,0 +1,30 @@
+
+package t6278
+
+import language.implicitConversions
+
+object test {
+ def ok(): Unit = {
+ 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(): Unit = {
+ 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]): Unit = {
+ ok(); nope()
+ }
+}