summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/names-defaults-neg.check28
-rw-r--r--test/files/neg/names-defaults-neg.scala47
2 files changed, 74 insertions, 1 deletions
diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check
index ec786c5e03..1f77b828b7 100644
--- a/test/files/neg/names-defaults-neg.check
+++ b/test/files/neg/names-defaults-neg.check
@@ -132,5 +132,31 @@ names-defaults-neg.scala:131: error: parameter specified twice: a
names-defaults-neg.scala:132: error: wrong number of parameters; expected = 2
val taf4: (Int, String) => Unit = testAnnFun(_, b = _)
^
+names-defaults-neg.scala:140: error: variable definition needs type because the name is used as named argument the definition.
+ def t3 { var x = t.f(x = 1) }
+ ^
+names-defaults-neg.scala:143: error: variable definition needs type because the name is used as named argument the definition.
+ object t6 { var x = t.f(x = 1) }
+ ^
+names-defaults-neg.scala:146: error: variable definition needs type because the name is used as named argument the definition.
+ class t9 { var x = t.f(x = 1) }
+ ^
+names-defaults-neg.scala:160: error: variable definition needs type because the name is used as named argument the definition.
+ def u3 { var x = u.f(x = 1) }
+ ^
+names-defaults-neg.scala:163: error: variable definition needs type because the name is used as named argument the definition.
+ def u6 { var x = u.f(x = "32") }
+ ^
+names-defaults-neg.scala:166: error: reference to x is ambiguous; it is both, a parameter
+name of the method and the name of a variable currently in scope.
+ def u9 { var x: Int = u.f(x = 1) }
+ ^
+names-defaults-neg.scala:173: error: variable definition needs type because the name is used as named argument the definition.
+ class u15 { var x = u.f(x = 1) }
+ ^
+names-defaults-neg.scala:176: error: reference to x is ambiguous; it is both, a parameter
+name of the method and the name of a variable currently in scope.
+ class u18 { var x: Int = u.f(x = 1) }
+ ^
one warning found
-32 errors found
+40 errors found
diff --git a/test/files/neg/names-defaults-neg.scala b/test/files/neg/names-defaults-neg.scala
index 8d1ec4ce96..4350f9860d 100644
--- a/test/files/neg/names-defaults-neg.scala
+++ b/test/files/neg/names-defaults-neg.scala
@@ -131,3 +131,50 @@ object anfun {
val taf3 = testAnnFun(b = _: String, a = get(8))
val taf4: (Int, String) => Unit = testAnnFun(_, b = _)
}
+
+object t3685 {
+ object t { def f(x: Int) = x }
+
+ def t1 { def x = t.f(x = 1) }
+ def t2 { val x = t.f(x = 1) }
+ def t3 { var x = t.f(x = 1) }
+ object t4 { def x = t.f(x = 1) }
+ object t5 { val x = t.f(x = 1) }
+ object t6 { var x = t.f(x = 1) }
+ class t7 { def x = t.f(x = 1) }
+ class t8 { val x = t.f(x = 1) }
+ class t9 { var x = t.f(x = 1) }
+
+ def t10 { def x: Int = t.f(x = 1) }
+ def t11 { val x: Int = t.f(x = 1) }
+ def t12 { var x: Int = t.f(x = 1) }
+ class t13 { def x: Int = t.f(x = 1) }
+ class t14 { val x: Int = t.f(x = 1) }
+ class t15 { var x: Int = t.f(x = 1) }
+
+
+ object u { def f[T](x: T) = 100 }
+
+ def u1 { def x = u.f(x = 1) }
+ def u2 { val x = u.f(x = 1) }
+ def u3 { var x = u.f(x = 1) }
+ def u4 { def x = u.f(x = "23") }
+ def u5 { val x = u.f(x = "32") }
+ def u6 { var x = u.f(x = "32") }
+ def u7 { def x: Int = u.f(x = 1) }
+ def u8 { val x: Int = u.f(x = 1) }
+ def u9 { var x: Int = u.f(x = 1) }
+ def u10 { def x: Int = u.f(x = "32") }
+ def u11 { val x: Int = u.f(x = "32") }
+ def u12 { var x: Int = u.f(x = "32") }
+
+ class u13 { def x = u.f(x = 1) }
+ class u14 { val x = u.f(x = 1) }
+ class u15 { var x = u.f(x = 1) }
+ class u16 { def x: Int = u.f(x = 1) }
+ class u17 { val x: Int = u.f(x = 1) }
+ class u18 { var x: Int = u.f(x = 1) }
+ class u19 { def x: Int = u.f(x = "32") }
+ class u20 { val x: Int = u.f(x = "32") }
+ class u21 { var x: Int = u.f(x = "32") }
+}