summaryrefslogtreecommitdiff
path: root/test/files/neg/t8841.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2014-12-11 12:57:32 +0100
committerLukas Rytz <lukas.rytz@gmail.com>2014-12-12 08:18:30 +0100
commita4a892fb0196f2f66d86f9cfa508deabe7d2aaae (patch)
treef86405ae87fe1ebac37f92bef3a01d94d8075c91 /test/files/neg/t8841.scala
parent36b1014ac63205a38e73ae18a05ac6f956c3410f (diff)
downloadscala-a4a892fb0196f2f66d86f9cfa508deabe7d2aaae.tar.gz
scala-a4a892fb0196f2f66d86f9cfa508deabe7d2aaae.tar.bz2
scala-a4a892fb0196f2f66d86f9cfa508deabe7d2aaae.zip
SI-8841 report named arg / assignment ambiguity also in silent mode.
For local definitions (eg. in a block that is an argument of a method call), the type completer may have a silent context. A CyclicReference is then not thrown but transformed into a NormalTypeError. When deciding if 'x = e' is an assignment or a named arg, we need to report cyclic references, but not other type errors. In the above case, the cyclic reference was not reported. Also makes sure that warnings are printed after typing argument expressions.
Diffstat (limited to 'test/files/neg/t8841.scala')
-rw-r--r--test/files/neg/t8841.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/files/neg/t8841.scala b/test/files/neg/t8841.scala
new file mode 100644
index 0000000000..80430d997e
--- /dev/null
+++ b/test/files/neg/t8841.scala
@@ -0,0 +1,15 @@
+class Cell(val ambiguousName: Option[String])
+
+class Test {
+ def wrap(f: Any): Nothing = ???
+
+ wrap {
+ // the namer for these two ValDefs is created when typing the argument expression
+ // of wrap. This happens to be in a silent context (tryTypedApply). Therefore, the
+ // cyclic reference will not be thrown, but transformed into a NormalTypeError by
+ // `silent`. This requires different handling in NamesDefaults.
+
+ val c = new Cell(ambiguousName = Some("bla"))
+ val ambiguousName = c.ambiguousName
+ }
+}