diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-05-25 22:57:33 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-10-23 14:23:08 +0200 |
commit | ce74bb00603f23087fbd3b0fe2870f09d73bb676 (patch) | |
tree | 0ac33983fb5d23cd85d4fbe08d67654257cc72a3 /test/files | |
parent | e6a5e692f58892dcf080fb3fe4fc4f8100e63301 (diff) | |
download | scala-ce74bb00603f23087fbd3b0fe2870f09d73bb676.tar.gz scala-ce74bb00603f23087fbd3b0fe2870f09d73bb676.tar.bz2 scala-ce74bb00603f23087fbd3b0fe2870f09d73bb676.zip |
[nomaster] SI-7519 Less brutal attribute resetting in adapt fallback
Prefers `resetLocalAttrs` over `resetAllAttrs`. The latter loses
track of which enclosing class of the given name is referenced by
a `This` node which prefixes the an applied implicit view.
The code that `resetAllAttrs` originally landed in: https://github.com/scala/scala/commit/d4c63b#L6R804
Cherry picked from 433880e91cba9e1e926e9fcbf04ecd4aeb1d73eb
Conflicts:
src/compiler/scala/tools/nsc/typechecker/Typers.scala
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t7519.check | 7 | ||||
-rw-r--r-- | test/files/neg/t7519.scala | 18 |
2 files changed, 25 insertions, 0 deletions
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" + } + } +} |