diff options
author | Martin Odersky <odersky@gmail.com> | 2013-12-10 22:05:50 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-12-10 22:05:50 +0100 |
commit | 382e04d4b8a42c0d0c30d4faae623c9d213e5336 (patch) | |
tree | c2aa0b181db5a95030f6264a1146970b9140923c /tests/neg/typedIdents.scala | |
parent | a2e1606a03b1ebd7553ee6f10b04227bfd69c9e1 (diff) | |
download | dotty-382e04d4b8a42c0d0c30d4faae623c9d213e5336.tar.gz dotty-382e04d4b8a42c0d0c30d4faae623c9d213e5336.tar.bz2 dotty-382e04d4b8a42c0d0c30d4faae623c9d213e5336.zip |
Fixes and tests for typedIdent
Fixed a problem where an import and a definition in same scope were erroneously regarded as a conflict (L20 in typedIdents.scala)
Diffstat (limited to 'tests/neg/typedIdents.scala')
-rw-r--r-- | tests/neg/typedIdents.scala | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/neg/typedIdents.scala b/tests/neg/typedIdents.scala new file mode 100644 index 000000000..b664da42d --- /dev/null +++ b/tests/neg/typedIdents.scala @@ -0,0 +1,34 @@ +package P { + object X { val x = 1; val y = 2 } +} +package Q { + object X { val x = true; val y = "" } +} +package P { // `X' bound by package clause + import Console._ // `println' bound by wildcard import + object A { + println("L4: " + X) // `X' refers to `P.X' here + object B { + import Q._ // `X' bound by wildcard import + println("L7: " + X) // `X' refers to `Q.X' here + import X._ // `x' and `y' bound by wildcard import + println("L8: " + x) // `x' refers to `Q.X.x' here + object C { + val x = 3 // `x' bound by local definition + println("L12: " + x) // `x' refers to constant `3' here + locally { + import Q.X._ // `x' and `y' bound by wildcard import + println("L14: "+x) // reference to `x' is ambiguous here + import X.y // `y' bound by explicit import + println("L16: " + y) // `y' refers to `Q.X.y' here + locally { + import P.X._ // `x' and `y' bound by wildcard import + val x = "abc" // `x' bound by local definition + println("L19: "+y) // reference to `y' is ambiguous here + println("L20: " + x) // `x' refers to string ``abc'' here + } + } + } + } + } +}
\ No newline at end of file |