diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-10-24 10:42:30 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-10-24 10:42:30 -0700 |
commit | 05681d4def04f290728e673b7856a57b872c8019 (patch) | |
tree | f9a5a4ed762586a5a0234d04c779b79fcaf8acb4 /test/files | |
parent | daa86942900ecfa2e48dfbb31aa50fe5d56ee937 (diff) | |
parent | 50c8b39ec4e795b6de7b8ebeb6e20bf5c4b7f9e0 (diff) | |
download | scala-05681d4def04f290728e673b7856a57b872c8019.tar.gz scala-05681d4def04f290728e673b7856a57b872c8019.tar.bz2 scala-05681d4def04f290728e673b7856a57b872c8019.zip |
Merge pull request #3072 from retronym/backport/7519
[nomaster] SI-7519 Less brutal attribute resetting in adapt fallback
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t7519-b.check | 4 | ||||
-rw-r--r-- | test/files/neg/t7519-b/Mac_1.scala | 14 | ||||
-rw-r--r-- | test/files/neg/t7519-b/Use_2.scala | 8 | ||||
-rw-r--r-- | test/files/neg/t7519.check | 7 | ||||
-rw-r--r-- | test/files/neg/t7519.scala | 18 |
5 files changed, 51 insertions, 0 deletions
diff --git a/test/files/neg/t7519-b.check b/test/files/neg/t7519-b.check new file mode 100644 index 0000000000..ad554b8633 --- /dev/null +++ b/test/files/neg/t7519-b.check @@ -0,0 +1,4 @@ +Use_2.scala:6: error: No implicit view available from String => K. + val x: Q = ex.Mac.mac("asdf") + ^ +one error found diff --git a/test/files/neg/t7519-b/Mac_1.scala b/test/files/neg/t7519-b/Mac_1.scala new file mode 100644 index 0000000000..55b583d24b --- /dev/null +++ b/test/files/neg/t7519-b/Mac_1.scala @@ -0,0 +1,14 @@ +// get expected error message without package declaration +package ex + +import scala.language.experimental.macros +import scala.reflect.macros._ + +object IW { + def foo(a: String): String = ??? +} +object Mac { + def mac(s: String): String = macro macImpl + def macImpl(c: Context)(s: c.Expr[String]): c.Expr[String] = + c.universe.reify(IW.foo(s.splice)) +} diff --git a/test/files/neg/t7519-b/Use_2.scala b/test/files/neg/t7519-b/Use_2.scala new file mode 100644 index 0000000000..413e40e25e --- /dev/null +++ b/test/files/neg/t7519-b/Use_2.scala @@ -0,0 +1,8 @@ +trait Q +trait K + +object Use { + implicit def cd[T](p: T)(implicit ev: T => K): Q = ??? + val x: Q = ex.Mac.mac("asdf") +} + diff --git a/test/files/neg/t7519.check b/test/files/neg/t7519.check new file mode 100644 index 0000000000..164d67f595 --- /dev/null +++ b/test/files/neg/t7519.check @@ -0,0 +1,7 @@ +t7519.scala:5: error: could not find implicit value for parameter nada: Nothing + locally(0 : String) // was: "value conversion is not a member of C.this.C" + ^ +t7519.scala:15: error: could not find implicit value for parameter nada: Nothing + locally(0 : String) // was: "value conversion is not a member of U" + ^ +two errors found diff --git a/test/files/neg/t7519.scala b/test/files/neg/t7519.scala new file mode 100644 index 0000000000..aea0f35d8e --- /dev/null +++ b/test/files/neg/t7519.scala @@ -0,0 +1,18 @@ +class C { + implicit def conversion(m: Int)(implicit nada: Nothing): String = ??? + + class C { // rename class to get correct error, can't find implicit: Nothing. + locally(0 : String) // was: "value conversion is not a member of C.this.C" + } +} + +object Test2 { + trait T; trait U + new T { + implicit def conversion(m: Int)(implicit nada: Nothing): String = ??? + + new U { // nested anonymous classes also share a name. + locally(0 : String) // was: "value conversion is not a member of U" + } + } +} |