diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-02-12 17:07:05 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-02-12 17:08:13 +0100 |
commit | 2d4d2d3f26e66cc1be6dc32ff37ba889bd4c8d0a (patch) | |
tree | e558fc83336915da904be2c362ed657ab5d6273a /test/files/neg | |
parent | 00067482917cbe7ac337550e1f565fea966c2d78 (diff) | |
download | scala-2d4d2d3f26e66cc1be6dc32ff37ba889bd4c8d0a.tar.gz scala-2d4d2d3f26e66cc1be6dc32ff37ba889bd4c8d0a.tar.bz2 scala-2d4d2d3f26e66cc1be6dc32ff37ba889bd4c8d0a.zip |
A test case for a name binding progression
I noticed the change when adapting Slick to work with
Scala 2.11 in `AbstractSourceCodeGenerator.scala`.
The behaviour changed in a70c8219.
This commit locks down the new, correct behaviour with a test.
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/name-lookup-stable.check | 11 | ||||
-rw-r--r-- | test/files/neg/name-lookup-stable.scala | 20 |
2 files changed, 31 insertions, 0 deletions
diff --git a/test/files/neg/name-lookup-stable.check b/test/files/neg/name-lookup-stable.check new file mode 100644 index 0000000000..751df9505e --- /dev/null +++ b/test/files/neg/name-lookup-stable.check @@ -0,0 +1,11 @@ +name-lookup-stable.scala:15: error: reference to PrimaryKey is ambiguous; +it is both defined in class A and imported subsequently by +import ColumnOption._ + (null: Any) match { case PrimaryKey => } + ^ +name-lookup-stable.scala:17: error: reference to PrimaryKey is ambiguous; +it is both defined in class A and imported subsequently by +import ColumnOption._ + PrimaryKey // was already ambigious in 2.10.3 + ^ +two errors found diff --git a/test/files/neg/name-lookup-stable.scala b/test/files/neg/name-lookup-stable.scala new file mode 100644 index 0000000000..0d862f06e1 --- /dev/null +++ b/test/files/neg/name-lookup-stable.scala @@ -0,0 +1,20 @@ +// This used to compile under 2.10.3 but the ambiguity is now noticed +// in 2.11.x (after a70c8219). I think the new behaviour is correct; +// we shouldn't discard names based on "expected stability" before +// evaluating ambiguity. +object ColumnOption { + object PrimaryKey +} + +class A { + def PrimaryKey: Any = ??? + + { + import ColumnOption._ + + (null: Any) match { case PrimaryKey => } + + PrimaryKey // was already ambigious in 2.10.3 + } +} + |