aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/disabled/pos/depmet_implicit_oopsla_session_simpler.scala (renamed from tests/pending/pos/depmet_implicit_oopsla_session_simpler.scala)3
-rw-r--r--tests/disabled/scalac-dependent/pos/contextbounds-implicits-new.scala (renamed from tests/pos/contextbounds-implicits-new.scala)0
-rw-r--r--tests/disabled/scalac-dependent/pos/spec-doubledef-new.scala (renamed from tests/pos/spec-doubledef-new.scala)0
-rw-r--r--tests/disabled/scalac-dependent/pos/t7688.scala (renamed from tests/pos-scala2/t7688.scala)0
-rw-r--r--tests/disabled/scalac-dependent/pos/t8187.scala (renamed from tests/pos/t8187.scala)0
-rw-r--r--tests/disabled/scalac-dependent/run/bytecodecs.scala (renamed from tests/run/bytecodecs.scala)0
-rw-r--r--tests/disabled/scalac-dependent/run/var-arity-class-symbol.scala (renamed from tests/run/var-arity-class-symbol.scala)0
-rw-r--r--tests/neg/falseView.scala7
-rw-r--r--tests/neg/i1706.scala3
-rw-r--r--tests/neg/i2051.scala2
-rw-r--r--tests/neg/i2066.scala27
-rw-r--r--tests/neg/i2086a.scala4
-rw-r--r--tests/neg/i2086b.scala5
-rw-r--r--tests/neg/i2117.scala3
-rw-r--r--tests/neg/i2151.scala6
-rw-r--r--tests/neg/i941.scala2
-rw-r--r--tests/neg/illegal-depmeth.scala13
-rw-r--r--tests/neg/instantiateAbstract.scala2
-rw-r--r--tests/neg/leak-type.scala13
-rw-r--r--tests/neg/t1569-failedAvoid.scala9
-rw-r--r--tests/neg/t1625.scala3
-rw-r--r--tests/neg/t1625b.scala3
-rw-r--r--tests/neg/t1625c.scala3
-rw-r--r--tests/neg/t1625d.scala3
-rw-r--r--tests/neg/t1625e.scala3
-rw-r--r--tests/partest-test/i2147.check3
-rw-r--r--tests/partest-test/i2147.scala7
-rw-r--r--tests/partest-test/negAnnotWrongLine.scala3
-rw-r--r--tests/partest-test/negMissingAnnot.scala1
-rw-r--r--tests/partest-test/negNoPositionAnnots.scala5
-rw-r--r--tests/partest-test/negTooManyAnnots.scala3
-rw-r--r--tests/partest-test/posFail1Error.scala3
-rw-r--r--tests/partest-test/runDiffOutput1.check5
-rw-r--r--tests/partest-test/runDiffOutput1.scala9
-rw-r--r--tests/partest-test/runWrongOutput1.check6
-rw-r--r--tests/partest-test/runWrongOutput1.scala9
-rw-r--r--tests/partest-test/runWrongOutput2.check3
-rw-r--r--tests/partest-test/runWrongOutput2.scala9
-rw-r--r--tests/partest-test/stackOverflow.scala7
-rw-r--r--tests/pending/pos/depmet_implicit_oopsla_session_2.scala5
-rw-r--r--tests/pending/pos/false-companion/00_outerinnerTest_2.scala5
-rw-r--r--tests/pending/pos/false-companion/01_outerinnerFoo_2.scala5
-rw-r--r--tests/pending/pos/false-companion/outerFoo_1.scala2
-rw-r--r--tests/pending/pos/false-companion/outerinnerFoo_1.scala5
-rw-r--r--tests/pickling/default-param-interface.scala3
-rw-r--r--tests/pickling/i982.scala (renamed from tests/tasty/i982.scala)0
-rw-r--r--tests/pickling/innerclass.scala3
-rw-r--r--tests/pos-java-interop/varargsOverride/Base.java5
-rw-r--r--tests/pos-java-interop/varargsOverride/Sub.scala3
-rw-r--r--tests/pos-scala2/typerep-stephane.scala (renamed from tests/pos/typerep-stephane.scala)0
-rw-r--r--tests/pos-scala2/viewtest1.scala (renamed from tests/pos/viewtest1.scala)0
-rw-r--r--tests/pos/constraining-lub.scala34
-rw-r--r--tests/pos/depmet_implicit_norm_ret.scala (renamed from tests/pending/pos/depmet_implicit_norm_ret.scala)0
-rw-r--r--tests/pos/erased-lub-2.scala15
-rw-r--r--tests/pos/hk-reduce-variance.scala3
-rw-r--r--tests/pos/i1130.scala4
-rw-r--r--tests/pos/i2051.scala9
-rw-r--r--tests/pos/i2064.scala15
-rw-r--r--tests/pos/i2066.scala15
-rw-r--r--tests/pos/i2071.scala7
-rw-r--r--tests/pos/i851.java2
-rw-r--r--tests/pos/leak-inferred.scala12
-rw-r--r--tests/pos/param-depmeth.scala15
-rw-r--r--tests/pos/t0786.scala2
-rw-r--r--tests/pos/t1569.scala12
-rw-r--r--tests/pos/t1625.scala3
-rw-r--r--tests/pos/t1625b.scala3
-rw-r--r--tests/pos/t2421_delitedsl.scala3
-rw-r--r--tests/pos/t5070.scala23
-rw-r--r--tests/pos/t5643.scala19
-rw-r--r--tests/repl/functions.check5
-rw-r--r--tests/repl/infixTypeOp.check5
-rw-r--r--tests/run/HLists-nonvariant.check8
-rw-r--r--tests/run/HLists-nonvariant.scala78
-rw-r--r--tests/run/HLists.check8
-rw-r--r--tests/run/HLists.scala78
-rw-r--r--tests/run/caseClassHash.check8
-rw-r--r--tests/run/getclass.check4
-rw-r--r--tests/run/getclass.scala6
-rw-r--r--tests/run/hmap-covariant.scala97
-rw-r--r--tests/run/i1573.check1
-rw-r--r--tests/run/i1573.scala9
-rw-r--r--tests/run/i1960.scala8
-rw-r--r--tests/run/i2004.check1
-rw-r--r--tests/run/i2004.scala11
-rw-r--r--tests/run/i2077.check1
-rw-r--r--tests/run/i2077.scala10
-rw-r--r--tests/run/i2147.check3
-rw-r--r--tests/run/i2147.scala7
-rw-r--r--tests/run/i2156.scala37
-rw-r--r--tests/run/iterator-from.scala6
-rw-r--r--tests/run/origins.check6
-rw-r--r--tests/run/origins.flags1
-rw-r--r--tests/run/origins.scala21
-rw-r--r--tests/run/paramForwarding.check2
-rw-r--r--tests/run/paramForwarding.scala6
-rw-r--r--tests/run/paramForwarding_separate.check6
-rw-r--r--tests/run/paramForwarding_separate/A_1.scala7
-rw-r--r--tests/run/paramForwarding_separate/B_2.scala21
-rw-r--r--tests/run/paramForwarding_together.check6
-rw-r--r--tests/run/paramForwarding_together.scala29
-rw-r--r--tests/run/paramForwarding_together_b.check6
-rw-r--r--tests/run/paramForwarding_together_b.scala30
-rw-r--r--tests/run/puzzler54.scala13
-rw-r--r--tests/run/shutdownhooks.check3
-rw-r--r--tests/run/shutdownhooks.scala37
-rw-r--r--tests/run/static/i2054.scala13
-rw-r--r--tests/run/t4400.scala35
-rw-r--r--tests/run/t8280.check3
-rw-r--r--tests/run/t8280.scala9
-rw-r--r--tests/run/variable-pattern-access.check7
-rw-r--r--tests/run/variable-pattern-access.scala16
112 files changed, 983 insertions, 104 deletions
diff --git a/tests/pending/pos/depmet_implicit_oopsla_session_simpler.scala b/tests/disabled/pos/depmet_implicit_oopsla_session_simpler.scala
index fad5eba40..8cc6fe754 100644
--- a/tests/pending/pos/depmet_implicit_oopsla_session_simpler.scala
+++ b/tests/disabled/pos/depmet_implicit_oopsla_session_simpler.scala
@@ -1,3 +1,4 @@
+// Disabled because we now get an unsafe instantiation error
object Sessions {
trait Session {
type Dual <: Session
@@ -40,5 +41,5 @@ object Sessions {
In{z: Int => System.out.println(z)
Stop()}}))
- def myRun = addServer run addClient
+ def myRun = addServer run addClient // error: unsafe instantiation
}
diff --git a/tests/pos/contextbounds-implicits-new.scala b/tests/disabled/scalac-dependent/pos/contextbounds-implicits-new.scala
index 8389d1332..8389d1332 100644
--- a/tests/pos/contextbounds-implicits-new.scala
+++ b/tests/disabled/scalac-dependent/pos/contextbounds-implicits-new.scala
diff --git a/tests/pos/spec-doubledef-new.scala b/tests/disabled/scalac-dependent/pos/spec-doubledef-new.scala
index de438d6e9..de438d6e9 100644
--- a/tests/pos/spec-doubledef-new.scala
+++ b/tests/disabled/scalac-dependent/pos/spec-doubledef-new.scala
diff --git a/tests/pos-scala2/t7688.scala b/tests/disabled/scalac-dependent/pos/t7688.scala
index 5a846b97e..5a846b97e 100644
--- a/tests/pos-scala2/t7688.scala
+++ b/tests/disabled/scalac-dependent/pos/t7688.scala
diff --git a/tests/pos/t8187.scala b/tests/disabled/scalac-dependent/pos/t8187.scala
index 84b8cd0f4..84b8cd0f4 100644
--- a/tests/pos/t8187.scala
+++ b/tests/disabled/scalac-dependent/pos/t8187.scala
diff --git a/tests/run/bytecodecs.scala b/tests/disabled/scalac-dependent/run/bytecodecs.scala
index 454958dfa..454958dfa 100644
--- a/tests/run/bytecodecs.scala
+++ b/tests/disabled/scalac-dependent/run/bytecodecs.scala
diff --git a/tests/run/var-arity-class-symbol.scala b/tests/disabled/scalac-dependent/run/var-arity-class-symbol.scala
index 2a7d32987..2a7d32987 100644
--- a/tests/run/var-arity-class-symbol.scala
+++ b/tests/disabled/scalac-dependent/run/var-arity-class-symbol.scala
diff --git a/tests/neg/falseView.scala b/tests/neg/falseView.scala
new file mode 100644
index 000000000..613abe3f1
--- /dev/null
+++ b/tests/neg/falseView.scala
@@ -0,0 +1,7 @@
+object Test {
+
+ private implicit val xs: Map[String, Int] = ???
+
+ val x: Int = "abc" // error
+
+}
diff --git a/tests/neg/i1706.scala b/tests/neg/i1706.scala
new file mode 100644
index 000000000..b55ff6e2d
--- /dev/null
+++ b/tests/neg/i1706.scala
@@ -0,0 +1,3 @@
+object Test {
+ println (Object.reflect.runtime.universe.reify (new Object().getClass)) // error: not found Object
+}
diff --git a/tests/neg/i2051.scala b/tests/neg/i2051.scala
new file mode 100644
index 000000000..2295a05ab
--- /dev/null
+++ b/tests/neg/i2051.scala
@@ -0,0 +1,2 @@
+abstract class C { val x: Int }
+class D extends C { def x = 1 } // error: method x of type => Int needs to be a stable, immutable value
diff --git a/tests/neg/i2066.scala b/tests/neg/i2066.scala
new file mode 100644
index 000000000..0081cec07
--- /dev/null
+++ b/tests/neg/i2066.scala
@@ -0,0 +1,27 @@
+class Foo
+
+object Test {
+ implicit def two(x: Foo): Two = new Two(x)
+
+ class Two(x: Foo) {
+ private def meth: Unit = {}
+
+ def test2(foo: Foo): Unit = {
+ foo.meth // error
+ }
+ }
+}
+
+
+object Test2 {
+
+ class Two(x: Foo) {
+ implicit def two(x: Foo): Two = new Two(x)
+
+ private def meth: Unit = {}
+
+ def test2(foo: Foo): Unit = {
+ foo.meth // error
+ }
+ }
+}
diff --git a/tests/neg/i2086a.scala b/tests/neg/i2086a.scala
new file mode 100644
index 000000000..b80535c2c
--- /dev/null
+++ b/tests/neg/i2086a.scala
@@ -0,0 +1,4 @@
+
+object Test { // error: Test cannot be instantiated since it has a member type Foo with possibly conflicting bounds Any <: ... <: Nothing
+ type Foo >: Any <: Nothing
+}
diff --git a/tests/neg/i2086b.scala b/tests/neg/i2086b.scala
new file mode 100644
index 000000000..0a5e296fd
--- /dev/null
+++ b/tests/neg/i2086b.scala
@@ -0,0 +1,5 @@
+
+object Test { // error: Test cannot be instantiated since it has a member type Bound with possibly conflicting bounds [Left, Right] => Left <: ... <: [Left, Right] => Right
+ type Bound[Left, Right] >: Left <: Right
+ type Foo = Bound[Any, Nothing]
+}
diff --git a/tests/neg/i2117.scala b/tests/neg/i2117.scala
new file mode 100644
index 000000000..0e1d9e349
--- /dev/null
+++ b/tests/neg/i2117.scala
@@ -0,0 +1,3 @@
+class A {
+ C.super.foo() // error: C isn't an enclosing class
+}
diff --git a/tests/neg/i2151.scala b/tests/neg/i2151.scala
new file mode 100644
index 000000000..1ae034c02
--- /dev/null
+++ b/tests/neg/i2151.scala
@@ -0,0 +1,6 @@
+trait Test {
+ type Nil = [K] => K
+ type StrangeCons[H, Tail <: [H, A] => H] = Tail[H, H]
+
+ def list: StrangeCons[Int, Nil] // error
+}
diff --git a/tests/neg/i941.scala b/tests/neg/i941.scala
index 2643c2546..fc29cc27d 100644
--- a/tests/neg/i941.scala
+++ b/tests/neg/i941.scala
@@ -1,7 +1,7 @@
object Test {
def bar(tl: => String) = {
- val x = tl _ //error
+ val x = tl _ // error
val y = x _ // error
val s: String = x() // error
}
diff --git a/tests/neg/illegal-depmeth.scala b/tests/neg/illegal-depmeth.scala
new file mode 100644
index 000000000..e4d771a07
--- /dev/null
+++ b/tests/neg/illegal-depmeth.scala
@@ -0,0 +1,13 @@
+object Test {
+
+ class C { type T }
+
+ def f(x: C, y: x.T): x.T = y // ok
+
+ def g(y: x.T, x: C): x.T = y // error
+
+ def h(x: x.T) = ??? // error
+
+ def g(x: => C): x.T = ??? // error: x is not stable
+
+}
diff --git a/tests/neg/instantiateAbstract.scala b/tests/neg/instantiateAbstract.scala
index 10eeac64d..a2ff38ef4 100644
--- a/tests/neg/instantiateAbstract.scala
+++ b/tests/neg/instantiateAbstract.scala
@@ -15,7 +15,7 @@ object Test {
@scala.annotation.Annotation type T = String // error
@scala.annotation.Annotation val x = 1 // error
- @scala.annotation.Annotation def f = 1 //error
+ @scala.annotation.Annotation def f = 1 // error
(1: @scala.annotation.Annotation) // error
diff --git a/tests/neg/leak-type.scala b/tests/neg/leak-type.scala
new file mode 100644
index 000000000..30ecab70b
--- /dev/null
+++ b/tests/neg/leak-type.scala
@@ -0,0 +1,13 @@
+trait A {
+ private type Foo = Int
+
+
+ class Inner[T <: Foo] { // error: non-private type T refers to private type Foo in its type signature
+ def get: T = ???
+ }
+}
+class B extends A {
+ def foo(x: Inner[_]): Unit = {
+ val a = x.get // error: cannot resolve reference to type B(B.this).Foo
+ }
+}
diff --git a/tests/neg/t1569-failedAvoid.scala b/tests/neg/t1569-failedAvoid.scala
deleted file mode 100644
index 45bb96f36..000000000
--- a/tests/neg/t1569-failedAvoid.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-// This was t1569.scala.
-// It fails in dotty because the expected type of the anonymous function in the last line
-// is fully determined (C). So that type is taken as the type of the anonymous function.
-// See pos/t1569a.scala for related examples that work.
-object Bug {
- class C { type T }
- def foo(x: Int)(y: C)(z: y.T): Unit = {}
- foo(3)(new C { type T = String })("hello") // error
-}
diff --git a/tests/neg/t1625.scala b/tests/neg/t1625.scala
new file mode 100644
index 000000000..aabb1ecea
--- /dev/null
+++ b/tests/neg/t1625.scala
@@ -0,0 +1,3 @@
+trait T3 {
+ def foo(x: String*, y: String*, c: String*): Int // error // error: varargs parameter must come last
+} \ No newline at end of file
diff --git a/tests/neg/t1625b.scala b/tests/neg/t1625b.scala
new file mode 100644
index 000000000..f2c544f42
--- /dev/null
+++ b/tests/neg/t1625b.scala
@@ -0,0 +1,3 @@
+object T5 {
+ case class Abc(x: String*, c: String*) // error // error: varargs parameter must come last AND found: String* required: String
+}
diff --git a/tests/neg/t1625c.scala b/tests/neg/t1625c.scala
new file mode 100644
index 000000000..74595cb7d
--- /dev/null
+++ b/tests/neg/t1625c.scala
@@ -0,0 +1,3 @@
+class Abc(val x: String*, val c: String*) { // error: varargs parameter must come last
+ def test = ???
+} \ No newline at end of file
diff --git a/tests/neg/t1625d.scala b/tests/neg/t1625d.scala
new file mode 100644
index 000000000..616ea0539
--- /dev/null
+++ b/tests/neg/t1625d.scala
@@ -0,0 +1,3 @@
+trait T2 {
+ def foo(x: String*, y: String*)(z: Boolean*)(u: Int*, l: Int*): Int // error // error: varargs parameter must come last
+} \ No newline at end of file
diff --git a/tests/neg/t1625e.scala b/tests/neg/t1625e.scala
new file mode 100644
index 000000000..eceb7e696
--- /dev/null
+++ b/tests/neg/t1625e.scala
@@ -0,0 +1,3 @@
+trait T1 {
+ def foo(x: String*, y: String): Int // error: varargs parameter must come last
+} \ No newline at end of file
diff --git a/tests/partest-test/i2147.check b/tests/partest-test/i2147.check
new file mode 100644
index 000000000..64a4b735b
--- /dev/null
+++ b/tests/partest-test/i2147.check
@@ -0,0 +1,3 @@
+Felix is number 1
+ducksarethebest.org
+foolsRus.org
diff --git a/tests/partest-test/i2147.scala b/tests/partest-test/i2147.scala
new file mode 100644
index 000000000..dd9839838
--- /dev/null
+++ b/tests/partest-test/i2147.scala
@@ -0,0 +1,7 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ println("Guillaume is number 1")
+ System.out.println("ducksarethebest.com")
+ System.err.println("foolsRus.com")
+ }
+}
diff --git a/tests/partest-test/negAnnotWrongLine.scala b/tests/partest-test/negAnnotWrongLine.scala
new file mode 100644
index 000000000..06ba0a2c3
--- /dev/null
+++ b/tests/partest-test/negAnnotWrongLine.scala
@@ -0,0 +1,3 @@
+object Foo { // error
+ def bar: Int = "LOL"
+}
diff --git a/tests/partest-test/negMissingAnnot.scala b/tests/partest-test/negMissingAnnot.scala
new file mode 100644
index 000000000..acffb37a3
--- /dev/null
+++ b/tests/partest-test/negMissingAnnot.scala
@@ -0,0 +1 @@
+class Foo extends Bar
diff --git a/tests/partest-test/negNoPositionAnnots.scala b/tests/partest-test/negNoPositionAnnots.scala
new file mode 100644
index 000000000..7f3ce7e34
--- /dev/null
+++ b/tests/partest-test/negNoPositionAnnots.scala
@@ -0,0 +1,5 @@
+object Foo {
+ def bar: Int = "LOL"
+
+ // nopos-error
+}
diff --git a/tests/partest-test/negTooManyAnnots.scala b/tests/partest-test/negTooManyAnnots.scala
new file mode 100644
index 000000000..5dbd2fd75
--- /dev/null
+++ b/tests/partest-test/negTooManyAnnots.scala
@@ -0,0 +1,3 @@
+object Test {
+ def foo: Int = "LOL" // error // error
+}
diff --git a/tests/partest-test/posFail1Error.scala b/tests/partest-test/posFail1Error.scala
new file mode 100644
index 000000000..c8b565498
--- /dev/null
+++ b/tests/partest-test/posFail1Error.scala
@@ -0,0 +1,3 @@
+object Test extends Bar {
+ def main(args: Array[String]): Unit = ()
+}
diff --git a/tests/partest-test/runDiffOutput1.check b/tests/partest-test/runDiffOutput1.check
new file mode 100644
index 000000000..6234030de
--- /dev/null
+++ b/tests/partest-test/runDiffOutput1.check
@@ -0,0 +1,5 @@
+1
+2
+4
+4
+5
diff --git a/tests/partest-test/runDiffOutput1.scala b/tests/partest-test/runDiffOutput1.scala
new file mode 100644
index 000000000..32cf6f5b6
--- /dev/null
+++ b/tests/partest-test/runDiffOutput1.scala
@@ -0,0 +1,9 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ println(1)
+ println(2)
+ println(3)
+ println(4)
+ println(5)
+ }
+}
diff --git a/tests/partest-test/runWrongOutput1.check b/tests/partest-test/runWrongOutput1.check
new file mode 100644
index 000000000..b414108e8
--- /dev/null
+++ b/tests/partest-test/runWrongOutput1.check
@@ -0,0 +1,6 @@
+1
+2
+3
+4
+5
+6
diff --git a/tests/partest-test/runWrongOutput1.scala b/tests/partest-test/runWrongOutput1.scala
new file mode 100644
index 000000000..32cf6f5b6
--- /dev/null
+++ b/tests/partest-test/runWrongOutput1.scala
@@ -0,0 +1,9 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ println(1)
+ println(2)
+ println(3)
+ println(4)
+ println(5)
+ }
+}
diff --git a/tests/partest-test/runWrongOutput2.check b/tests/partest-test/runWrongOutput2.check
new file mode 100644
index 000000000..01e79c32a
--- /dev/null
+++ b/tests/partest-test/runWrongOutput2.check
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/tests/partest-test/runWrongOutput2.scala b/tests/partest-test/runWrongOutput2.scala
new file mode 100644
index 000000000..32cf6f5b6
--- /dev/null
+++ b/tests/partest-test/runWrongOutput2.scala
@@ -0,0 +1,9 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ println(1)
+ println(2)
+ println(3)
+ println(4)
+ println(5)
+ }
+}
diff --git a/tests/partest-test/stackOverflow.scala b/tests/partest-test/stackOverflow.scala
new file mode 100644
index 000000000..b3132cc19
--- /dev/null
+++ b/tests/partest-test/stackOverflow.scala
@@ -0,0 +1,7 @@
+object Test {
+ def foo: Int = bar
+ def bar: Int = foo
+
+ def main(args: Array[String]): Unit =
+ println(foo)
+}
diff --git a/tests/pending/pos/depmet_implicit_oopsla_session_2.scala b/tests/pending/pos/depmet_implicit_oopsla_session_2.scala
index 29a76d5cf..26fa2a4cc 100644
--- a/tests/pending/pos/depmet_implicit_oopsla_session_2.scala
+++ b/tests/pending/pos/depmet_implicit_oopsla_session_2.scala
@@ -1,3 +1,8 @@
+// Fails on line 70 with: no implicit argument of type Sessions.Session[
+// | Sessions.In[Int, Sessions.In[Int, Sessions.Out[Int, Sessions.Stop]]]^
+// |]#HasDual[Sessions.Out[Int, Sessions.Out[Int, Sessions.In[Int, Sessions.Stop]]]^
+// | ] found for parameter evidence$1 of method runSession in object Sessions
+// This could be related to existential types (the # essentially boils down to one).
object Sessions {
def ?[T <: AnyRef](implicit w: T): w.type = w
diff --git a/tests/pending/pos/false-companion/00_outerinnerTest_2.scala b/tests/pending/pos/false-companion/00_outerinnerTest_2.scala
new file mode 100644
index 000000000..8f5802343
--- /dev/null
+++ b/tests/pending/pos/false-companion/00_outerinnerTest_2.scala
@@ -0,0 +1,5 @@
+package outer
+package inner
+object Test {
+ val x: Foo = new Foo
+}
diff --git a/tests/pending/pos/false-companion/01_outerinnerFoo_2.scala b/tests/pending/pos/false-companion/01_outerinnerFoo_2.scala
new file mode 100644
index 000000000..111f7fcd5
--- /dev/null
+++ b/tests/pending/pos/false-companion/01_outerinnerFoo_2.scala
@@ -0,0 +1,5 @@
+package outer
+package inner
+object Foo {
+ // val a: Int = 1
+}
diff --git a/tests/pending/pos/false-companion/outerFoo_1.scala b/tests/pending/pos/false-companion/outerFoo_1.scala
new file mode 100644
index 000000000..8c2ef109c
--- /dev/null
+++ b/tests/pending/pos/false-companion/outerFoo_1.scala
@@ -0,0 +1,2 @@
+package outer
+class Foo
diff --git a/tests/pending/pos/false-companion/outerinnerFoo_1.scala b/tests/pending/pos/false-companion/outerinnerFoo_1.scala
new file mode 100644
index 000000000..29f3df724
--- /dev/null
+++ b/tests/pending/pos/false-companion/outerinnerFoo_1.scala
@@ -0,0 +1,5 @@
+package outer
+package inner
+object Foo {
+ val a: Int = 1
+}
diff --git a/tests/pickling/default-param-interface.scala b/tests/pickling/default-param-interface.scala
new file mode 100644
index 000000000..919f4b627
--- /dev/null
+++ b/tests/pickling/default-param-interface.scala
@@ -0,0 +1,3 @@
+trait Foo {
+ def newName(prefix: String = "foo"): String
+}
diff --git a/tests/tasty/i982.scala b/tests/pickling/i982.scala
index 838b250d9..838b250d9 100644
--- a/tests/tasty/i982.scala
+++ b/tests/pickling/i982.scala
diff --git a/tests/pickling/innerclass.scala b/tests/pickling/innerclass.scala
new file mode 100644
index 000000000..5881cf6ed
--- /dev/null
+++ b/tests/pickling/innerclass.scala
@@ -0,0 +1,3 @@
+trait Foo {
+ class Inner(x: Int = 42)
+}
diff --git a/tests/pos-java-interop/varargsOverride/Base.java b/tests/pos-java-interop/varargsOverride/Base.java
new file mode 100644
index 000000000..a4607b71c
--- /dev/null
+++ b/tests/pos-java-interop/varargsOverride/Base.java
@@ -0,0 +1,5 @@
+class Base {
+ public Object foo(Object... x) {
+ return x;
+ }
+}
diff --git a/tests/pos-java-interop/varargsOverride/Sub.scala b/tests/pos-java-interop/varargsOverride/Sub.scala
new file mode 100644
index 000000000..9d3e2bf0d
--- /dev/null
+++ b/tests/pos-java-interop/varargsOverride/Sub.scala
@@ -0,0 +1,3 @@
+class Sub extends Base {
+ override def foo(x: Object*): Object = x
+}
diff --git a/tests/pos/typerep-stephane.scala b/tests/pos-scala2/typerep-stephane.scala
index 2cb899591..2cb899591 100644
--- a/tests/pos/typerep-stephane.scala
+++ b/tests/pos-scala2/typerep-stephane.scala
diff --git a/tests/pos/viewtest1.scala b/tests/pos-scala2/viewtest1.scala
index 38945ad2f..38945ad2f 100644
--- a/tests/pos/viewtest1.scala
+++ b/tests/pos-scala2/viewtest1.scala
diff --git a/tests/pos/constraining-lub.scala b/tests/pos/constraining-lub.scala
new file mode 100644
index 000000000..80da2ec86
--- /dev/null
+++ b/tests/pos/constraining-lub.scala
@@ -0,0 +1,34 @@
+class Inv[A](x: A)
+object Inv {
+ def empty[A]: Inv[A] = new Inv(???)
+}
+
+class Inv2[A](x: A)
+object Inv2 {
+ def empty[A]: Inv2[A] = new Inv2(???)
+}
+
+object Test {
+ def inv(cond: Boolean) =
+ if (cond)
+ new Inv(1)
+ else
+ Inv.empty
+
+ val x: Inv[Int] = inv(true)
+
+ def inv2(cond: Boolean) =
+ if (cond) {
+ if (cond)
+ new Inv(1)
+ else
+ Inv.empty
+ } else {
+ if (cond)
+ new Inv2(1)
+ else
+ Inv2.empty
+ }
+
+ val y: Inv[Int] | Inv2[Int] = inv2(true)
+}
diff --git a/tests/pending/pos/depmet_implicit_norm_ret.scala b/tests/pos/depmet_implicit_norm_ret.scala
index 42bfb9fe1..42bfb9fe1 100644
--- a/tests/pending/pos/depmet_implicit_norm_ret.scala
+++ b/tests/pos/depmet_implicit_norm_ret.scala
diff --git a/tests/pos/erased-lub-2.scala b/tests/pos/erased-lub-2.scala
new file mode 100644
index 000000000..f0f9b27cc
--- /dev/null
+++ b/tests/pos/erased-lub-2.scala
@@ -0,0 +1,15 @@
+trait Foo
+
+trait PF[A, +B] {
+ def apply(x: A): B
+}
+
+object Test {
+ def orElse2[A1, B1 >: Foo](that: PF[A1, B1]): PF[A1, B1] = ???
+
+ def identity[E]: PF[E, E] = ???
+
+ def foo: PF[Foo, Foo] = ???
+
+ def bla(foo: Foo) = orElse2(identity).apply(foo)
+}
diff --git a/tests/pos/hk-reduce-variance.scala b/tests/pos/hk-reduce-variance.scala
new file mode 100644
index 000000000..c69777992
--- /dev/null
+++ b/tests/pos/hk-reduce-variance.scala
@@ -0,0 +1,3 @@
+class Cov[+A](a: A) {
+ def foo = Seq(a)
+}
diff --git a/tests/pos/i1130.scala b/tests/pos/i1130.scala
index 8d71de5e8..c28eaa169 100644
--- a/tests/pos/i1130.scala
+++ b/tests/pos/i1130.scala
@@ -3,4 +3,6 @@ trait A {
def foo: Foo = 1
}
-class B extends A
+class B extends A {
+ foo
+}
diff --git a/tests/pos/i2051.scala b/tests/pos/i2051.scala
new file mode 100644
index 000000000..9e29eea22
--- /dev/null
+++ b/tests/pos/i2051.scala
@@ -0,0 +1,9 @@
+class A[T](val x:T)
+class B[T](override val x:T) extends A[T](x)
+
+class C[T](val x:T, val y: Int, val z: Boolean)
+class D[T](override val x:T, y: Int, z: Boolean) extends C[T](x, y, z)
+
+trait X(val x: Int, y: Int, z: Int)
+trait Y(override val x: Int, y: Int, z: Int) extends X
+class Z(override val x: Int, y: Int, z: Int) extends Y(x, y, z) with X(x, y, z)
diff --git a/tests/pos/i2064.scala b/tests/pos/i2064.scala
new file mode 100644
index 000000000..909923372
--- /dev/null
+++ b/tests/pos/i2064.scala
@@ -0,0 +1,15 @@
+object p {
+
+class Foo[T] {
+ // Crashes:
+ def f(): Foo[T] = (if (true) this else this).bar
+
+ // Works:
+ // def f(): Foo[T] = new Bar(if (true) this else this).bar
+}
+
+implicit class Bar[A](val self: A) {
+ def bar(): A = self
+}
+
+}
diff --git a/tests/pos/i2066.scala b/tests/pos/i2066.scala
new file mode 100644
index 000000000..505e5e334
--- /dev/null
+++ b/tests/pos/i2066.scala
@@ -0,0 +1,15 @@
+class Foo
+
+object Test {
+ implicit class One(x: Foo) {
+ def meth: Unit = {}
+ }
+
+ implicit class Two(x: Foo) {
+ private def meth: Unit = {}
+ }
+
+ def test(foo: Foo): Unit = {
+ foo.meth
+ }
+}
diff --git a/tests/pos/i2071.scala b/tests/pos/i2071.scala
new file mode 100644
index 000000000..1855dccf4
--- /dev/null
+++ b/tests/pos/i2071.scala
@@ -0,0 +1,7 @@
+object Test {
+ type PF[A, B] = PartialFunction[A, B]
+
+ val f: PF[Int, String] = {
+ case i => "bar"
+ }
+} \ No newline at end of file
diff --git a/tests/pos/i851.java b/tests/pos/i851.java
index 39e0bf350..cfd86ccc4 100644
--- a/tests/pos/i851.java
+++ b/tests/pos/i851.java
@@ -5,4 +5,4 @@ interface J<T> extends I<T> {
};
}
-class C<T> extends J<T> {} \ No newline at end of file
+class C<T> implements J<T> {}
diff --git a/tests/pos/leak-inferred.scala b/tests/pos/leak-inferred.scala
new file mode 100644
index 000000000..5d8a7e3bc
--- /dev/null
+++ b/tests/pos/leak-inferred.scala
@@ -0,0 +1,12 @@
+class A {
+ private val x = List(1,2)
+
+ val elem = x.head
+}
+
+class B extends A {
+ val a: Int = elem
+ // Without `checkNoPrivateLeaks`, we get:
+ // found: B.this.x.scala$collection$immutable$List$$A(B.this.elem)
+ // required: Int
+}
diff --git a/tests/pos/param-depmeth.scala b/tests/pos/param-depmeth.scala
new file mode 100644
index 000000000..2e887d181
--- /dev/null
+++ b/tests/pos/param-depmeth.scala
@@ -0,0 +1,15 @@
+object Test {
+
+ class C { type T }
+
+ def f(x: C, y: x.T): x.T = y // ok
+
+ val c = new C { type T = String }
+ val c2 = c
+
+ f(c, "abc")
+ f(new C{ type T = String}, "abc")
+
+ val d: (C{ type T = String}) # T = "abc"
+
+}
diff --git a/tests/pos/t0786.scala b/tests/pos/t0786.scala
index b320de0ed..9346afdff 100644
--- a/tests/pos/t0786.scala
+++ b/tests/pos/t0786.scala
@@ -15,7 +15,7 @@ object ImplicitProblem {
def eval = f(nullval[T]).eval + 1
}
- def depth[T](n: T)(implicit ev: T => Rep[T]) = n.eval
+ def depth[T](n: T)(implicit ev: T => Rep[T]) = ev(n).eval
def main(args: Array[String]): Unit = {
println(depth(nullval[M[Int]])) // (1) this works
diff --git a/tests/pos/t1569.scala b/tests/pos/t1569.scala
new file mode 100644
index 000000000..a2fbcf11f
--- /dev/null
+++ b/tests/pos/t1569.scala
@@ -0,0 +1,12 @@
+// See pos/t1569a.scala for related examples that work.
+object Bug {
+ class C { type T }
+ def foo(x: Int)(y: C)(z: y.T): Unit = {}
+ foo(3)(new C { type T = String })("hello")
+}
+object Bug2 {
+ class C { type T }
+ class D extends C { type T = String }
+ def foo(x: Int)(y: C)(z: y.T): Unit = {}
+ foo(3)(new D {})("hello")
+}
diff --git a/tests/pos/t1625.scala b/tests/pos/t1625.scala
new file mode 100644
index 000000000..c614f2dee
--- /dev/null
+++ b/tests/pos/t1625.scala
@@ -0,0 +1,3 @@
+trait T2 {
+ def foo(x: String, y: String*)(z: Boolean*)(u: Int, l: Int*): Int
+} \ No newline at end of file
diff --git a/tests/pos/t1625b.scala b/tests/pos/t1625b.scala
new file mode 100644
index 000000000..834960b4a
--- /dev/null
+++ b/tests/pos/t1625b.scala
@@ -0,0 +1,3 @@
+trait T1 {
+ def foo(x: String*): Int
+} \ No newline at end of file
diff --git a/tests/pos/t2421_delitedsl.scala b/tests/pos/t2421_delitedsl.scala
index 22f1ecd85..bde3593c9 100644
--- a/tests/pos/t2421_delitedsl.scala
+++ b/tests/pos/t2421_delitedsl.scala
@@ -1,6 +1,9 @@
trait DeliteDSL {
abstract class <~<[-From, +To] extends (From => To)
+
implicit def trivial[A]: A <~< A = new (A <~< A) {def apply(x: A) = x}
+ implicit def convert_<-<[A, B](x: A)(implicit ev: A <~< B): B = ev(x)
+
trait Forcible[T]
object Forcible {
diff --git a/tests/pos/t5070.scala b/tests/pos/t5070.scala
index 410afba14..0e5c0ffc0 100644
--- a/tests/pos/t5070.scala
+++ b/tests/pos/t5070.scala
@@ -13,3 +13,26 @@ class Test {
implicitly[a.T](b(a)) // works
}
+
+
+class ImplicitVsTypeAliasTezt {
+
+ class Monad[m[_]] {
+ type For[a] = _For[m, a]
+ implicit def toFor[a](m: m[a]): For[a] = throw new Error("todo") // lookup fails
+// implicit def toFor[a](m: m[a]): _For[m, a] = throw new Error("todo") // fine.
+ }
+
+ trait _For[m[_], a] {
+ def map[b](p: a => b): m[b]
+ }
+
+ def useMonad[m[_], a](m: m[a])(implicit i: Monad[m]) = {
+ import i._
+
+ // value map is not a member of type parameter m[a]
+ for {
+ x <- m
+ } yield x.toString
+ }
+}
diff --git a/tests/pos/t5643.scala b/tests/pos/t5643.scala
new file mode 100644
index 000000000..1ce34ba36
--- /dev/null
+++ b/tests/pos/t5643.scala
@@ -0,0 +1,19 @@
+object TupledEvidenceTest {
+
+ abstract class TupledEvidence[M[_], T0] { type T = T0 }
+
+ implicit def witnessTuple2[M[_], T1, T2](implicit ev1: M[T1], ev2: M[T2]):
+ TupledEvidence[M, (T1, T2)] { type T = (T1, T2) } = sys.error("")
+
+ class GetResult[T]
+
+ implicit val getString: GetResult[String] = new GetResult[String]
+
+ implicit def getTuple[T](implicit w: TupledEvidence[GetResult, T]): GetResult[w.T] = sys.error("")
+
+ def f[T : GetResult] = ""
+
+ f[(String,String)](getTuple[(String, String)])
+
+ f[(String,String)]
+}
diff --git a/tests/repl/functions.check b/tests/repl/functions.check
new file mode 100644
index 000000000..1e14e7019
--- /dev/null
+++ b/tests/repl/functions.check
@@ -0,0 +1,5 @@
+scala> object Test { def foo(p1: Int, p2: Int, p3: Int, p4: Int, p5: Int, p6: Int, p7: Int, p8: Int, p9: Int, p10: Int, p11: Int, p12: Int, p13: Int, p14: Int, p15: Int, p16: Int, p17: Int, p18: Int, p19: Int, p20: Int, p21: Int, p22: Int, p23: Int, p24: Int, p25: Int, p26: Int, p27: Int, p28: Int, p29: Int, p30: Int, p31: Int, p32: Int, p33: Int, p34: Int, p35: Int, p36: Int, p37: Int, p38: Int, p39: Int, p40: Int, p41: Int, p42: Int, p43: Int, p44: Int, p45: Int, p46: Int, p47: Int, p48: Int, p49: Int, p50: Int, p51: Int, p52: Int, p53: Int, p54: Int, p55: Int, p56: Int, p57: Int, p58: Int, p59: Int, p60: Int, p61: Int, p62: Int, p63: Int, p64: Int, p65: Int, p66: Int, p67: Int, p68: Int, p69: Int, p70: Int, p71: Int, p72: Int, p73: Int, p74: Int, p75: Int, p76: Int, p77: Int, p78: Int, p79: Int, p80: Int, p81: Int, p82: Int, p83: Int, p84: Int, p85: Int, p86: Int, p87: Int, p88: Int, p89: Int, p90: Int, p91: Int, p92: Int, p93: Int, p94: Int, p95: Int, p96: Int, p97: Int, p98: Int, p99: Int, p100: Int, p101: Int, p102: Int, p103: Int, p104: Int, p105: Int, p106: Int, p107: Int, p108: Int, p109: Int): Int = 42 }
+defined module Test
+scala> Test.foo(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109)
+val res0: Int = 42
+scala> :quit
diff --git a/tests/repl/infixTypeOp.check b/tests/repl/infixTypeOp.check
new file mode 100644
index 000000000..fe8e453fb
--- /dev/null
+++ b/tests/repl/infixTypeOp.check
@@ -0,0 +1,5 @@
+scala> trait +[A, B]
+defined trait +
+scala> type IntAndString = Int + String
+defined type alias IntAndString
+scala> :quit
diff --git a/tests/run/HLists-nonvariant.check b/tests/run/HLists-nonvariant.check
new file mode 100644
index 000000000..53efe30d7
--- /dev/null
+++ b/tests/run/HLists-nonvariant.check
@@ -0,0 +1,8 @@
+1
+A
+true
+true
+HCons(1,HCons(A,HCons(true,HNil)))
+1
+A
+true
diff --git a/tests/run/HLists-nonvariant.scala b/tests/run/HLists-nonvariant.scala
new file mode 100644
index 000000000..a3a639bcd
--- /dev/null
+++ b/tests/run/HLists-nonvariant.scala
@@ -0,0 +1,78 @@
+sealed trait HList
+case class HCons[HD, TL](hd: HD, tl: TL) extends HList
+case object HNil extends HList
+
+sealed trait Num
+case object Zero extends Num
+case class Succ[N <: Num](pred: N) extends Num
+
+object Test {
+
+ type HNil = HNil.type
+ type Zero = Zero.type
+
+ trait Concat[Xs <: HList, Ys <: HList, Zs <: HList] {
+ def concat(xs: Xs, ys: Ys): Zs
+ }
+
+ implicit def concatNil[Xs <: HList]: Concat[HNil, Xs, Xs] =
+ new Concat[HNil, Xs, Xs] {
+ def concat(fst: HNil, snd: Xs) = snd
+ }
+
+ implicit def concatCons[X, Xs <: HList, Ys <: HList, Zs <: HList](
+ implicit ev: Concat[Xs, Ys, Zs]
+ ): Concat[HCons[X, Xs], Ys, HCons[X, Zs]] =
+ new Concat[HCons[X, Xs], Ys, HCons[X, Zs]] {
+ def concat(xs: HCons[X, Xs], ys: Ys): HCons[X, Zs] =
+ HCons(xs.hd, ev.concat(xs.tl, ys))
+ }
+
+ def concat[Xs <: HList, Ys <: HList, Zs <: HList](xs: Xs, ys: Ys)(implicit ev: Concat[Xs, Ys, Zs]): Zs =
+ ev.concat(xs, ys)
+
+ val xs = HCons(1, HCons("A", HNil))
+ val ys = HCons(true, HNil)
+ val zs = concat(xs, ys)
+ val zs1: HCons[Int, HCons[String, HCons[Boolean, HNil]]] = zs
+
+ trait At[Xs <: HList, N <: Num] {
+ type Out
+ def at(xs: Xs, n: N): Out
+ }
+
+ implicit def atZero[XZ, Xs <: HList]: At[HCons[XZ, Xs], Zero] { type Out = XZ } =
+ new At[HCons[XZ, Xs], Zero] {
+ type Out = XZ
+ def at(xs: HCons[XZ, Xs], n: Zero) = xs.hd
+ }
+
+ implicit def atSucc[XX, Xs <: HList, N <: Num](
+ implicit ev: At[Xs, N]
+ ): At[HCons[XX, Xs], Succ[N]] { type Out = ev.Out } = new At[HCons[XX, Xs], Succ[N]] {
+ type Out = ev.Out
+ def at(xs: HCons[XX, Xs], n: Succ[N]): Out = ev.at(xs.tl, n.pred)
+ }
+
+ def at[Xs <: HList, N <: Num](xs: Xs, n: N)(
+ implicit ev: At[Xs, N]
+ ): ev.Out = ev.at(xs, n)
+
+ def main(args: Array[String]) = {
+ val ys1 = HCons(1, HNil)
+ println(at(ys1, Zero))
+
+ val ys2 = HCons(1, HCons("A", HNil))
+ val y2 = at(ys2, Succ(Zero))
+ println(at(ys2, Succ(Zero)))
+ val ys3 = HCons(1, HCons("A", HCons(true, HNil)))
+ println(at(ys3, Succ(Succ(Zero))))
+ val ys4 = HCons(1, HCons("A", HCons(true, HCons(1.0, HNil))))
+ println(at(ys4, Succ(Succ(Zero))))
+
+ println(zs1)
+ println(at(zs1, Zero))
+ println(at(zs1, Succ(Zero)))
+ println(at(zs1, Succ(Succ(Zero))))
+ }
+}
diff --git a/tests/run/HLists.check b/tests/run/HLists.check
new file mode 100644
index 000000000..53efe30d7
--- /dev/null
+++ b/tests/run/HLists.check
@@ -0,0 +1,8 @@
+1
+A
+true
+true
+HCons(1,HCons(A,HCons(true,HNil)))
+1
+A
+true
diff --git a/tests/run/HLists.scala b/tests/run/HLists.scala
new file mode 100644
index 000000000..eebbcb4cd
--- /dev/null
+++ b/tests/run/HLists.scala
@@ -0,0 +1,78 @@
+sealed trait HList
+case class HCons[+HD, +TL](hd: HD, tl: TL) extends HList
+case object HNil extends HList
+
+sealed trait Num
+case object Zero extends Num
+case class Succ[N <: Num](pred: N) extends Num
+
+object Test {
+
+ type HNil = HNil.type
+ type Zero = Zero.type
+
+ trait Concat[Xs <: HList, Ys <: HList, Zs <: HList] {
+ def concat(xs: Xs, ys: Ys): Zs
+ }
+
+ implicit def concatNil[Xs <: HList]: Concat[HNil, Xs, Xs] =
+ new Concat[HNil, Xs, Xs] {
+ def concat(fst: HNil, snd: Xs) = snd
+ }
+
+ implicit def concatCons[X, Xs <: HList, Ys <: HList, Zs <: HList](
+ implicit ev: Concat[Xs, Ys, Zs]
+ ): Concat[HCons[X, Xs], Ys, HCons[X, Zs]] =
+ new Concat[HCons[X, Xs], Ys, HCons[X, Zs]] {
+ def concat(xs: HCons[X, Xs], ys: Ys): HCons[X, Zs] =
+ HCons(xs.hd, ev.concat(xs.tl, ys))
+ }
+
+ def concat[Xs <: HList, Ys <: HList, Zs <: HList](xs: Xs, ys: Ys)(implicit ev: Concat[Xs, Ys, Zs]): Zs =
+ ev.concat(xs, ys)
+
+ val xs = HCons(1, HCons("A", HNil))
+ val ys = HCons(true, HNil)
+ val zs = concat(xs, ys)
+ val zs1: HCons[Int, HCons[String, HCons[Boolean, HNil]]] = zs
+
+ trait At[Xs <: HList, N <: Num] {
+ type Out
+ def at(xs: Xs, n: N): Out
+ }
+
+ implicit def atZero[XZ, Xs <: HList]: At[HCons[XZ, Xs], Zero] { type Out = XZ } =
+ new At[HCons[XZ, Xs], Zero] {
+ type Out = XZ
+ def at(xs: HCons[XZ, Xs], n: Zero) = xs.hd
+ }
+
+ implicit def atSucc[XX, Xs <: HList, N <: Num](
+ implicit ev: At[Xs, N]
+ ): At[HCons[XX, Xs], Succ[N]] { type Out = ev.Out } = new At[HCons[XX, Xs], Succ[N]] {
+ type Out = ev.Out
+ def at(xs: HCons[XX, Xs], n: Succ[N]): Out = ev.at(xs.tl, n.pred)
+ }
+
+ def at[Xs <: HList, N <: Num](xs: Xs, n: N)(
+ implicit ev: At[Xs, N]
+ ): ev.Out = ev.at(xs, n)
+
+ def main(args: Array[String]) = {
+ val ys1 = HCons(1, HNil)
+ println(at(ys1, Zero))
+
+ val ys2 = HCons(1, HCons("A", HNil))
+ val y2 = at(ys2, Succ(Zero))
+ println(at(ys2, Succ(Zero)))
+ val ys3 = HCons(1, HCons("A", HCons(true, HNil)))
+ println(at(ys3, Succ(Succ(Zero))))
+ val ys4 = HCons(1, HCons("A", HCons(true, HCons(1.0, HNil))))
+ println(at(ys4, Succ(Succ(Zero))))
+
+ println(zs1)
+ println(at(zs1, Zero))
+ println(at(zs1, Succ(Zero)))
+ println(at(zs1, Succ(Succ(Zero))))
+ }
+}
diff --git a/tests/run/caseClassHash.check b/tests/run/caseClassHash.check
index b5a6f08e9..332fd477d 100644
--- a/tests/run/caseClassHash.check
+++ b/tests/run/caseClassHash.check
@@ -1,9 +1,9 @@
Foo(true,-1,-1,d,-5,-10,500.0,500.0,List(),5.0)
Foo(true,-1,-1,d,-5,-10,500.0,500.0,List(),5)
-1383698062
-1383698062
+205963949
+205963949
true
-## method 1: 1383698062
-## method 2: 1383698062
+## method 1: 205963949
+## method 2: 205963949
Murmur 1: 1383698062
Murmur 2: 1383698062
diff --git a/tests/run/getclass.check b/tests/run/getclass.check
index 9d88762f4..ea73f6127 100644
--- a/tests/run/getclass.check
+++ b/tests/run/getclass.check
@@ -22,5 +22,5 @@ class [D
class [Lscala.collection.immutable.List;
Functions:
-class Test$$$Lambda$1
-class Test$$$Lambda$2
+class Test$$$Lambda$
+class Test$$$Lambda$
diff --git a/tests/run/getclass.scala b/tests/run/getclass.scala
index 7a13a61a2..b74e1b202 100644
--- a/tests/run/getclass.scala
+++ b/tests/run/getclass.scala
@@ -35,8 +35,8 @@ object Test {
println("\nFunctions:")
// FunctionN.getClass.toString has form of "class Test$$$Lambda$N/1349414238",
- // but number (1349414238) depends on environment
- println(f1.getClass.toString.takeWhile(_ != '/'))
- println(f2.getClass.toString.takeWhile(_ != '/'))
+ // but "N/1349414238" depends on environment
+ println(f1.getClass.toString.take("class Test$$$Lambda$".length))
+ println(f2.getClass.toString.take("class Test$$$Lambda$".length))
}
}
diff --git a/tests/run/hmap-covariant.scala b/tests/run/hmap-covariant.scala
new file mode 100644
index 000000000..475cc6ee6
--- /dev/null
+++ b/tests/run/hmap-covariant.scala
@@ -0,0 +1,97 @@
+trait Tuple
+case class TCons[+H, +T <: Tuple](h: H, t: T) extends Tuple
+final case object TNil extends Tuple
+
+// Type level natural numbers -------------------------------------------------
+
+sealed trait Nat
+sealed trait Succ[P <: Nat] extends Nat
+sealed trait Zero extends Nat
+
+// Accessor type class to compute the N'th element of an Tuple L --------------
+
+trait At[L <: Tuple, N <: Nat, Out] {
+ def apply(l: L): Out
+}
+
+object At {
+ implicit def caseZero[H, T <: Tuple]: At[H TCons T, Zero, H] =
+ new At[H TCons T, Zero, H] {
+ def apply(l: H TCons T): H = {
+ val (h TCons _) = l
+ h
+ }
+ }
+
+ implicit def caseN[H, T <: Tuple, N <: Nat, O]
+ (implicit a: At[T, N, O]): At[H TCons T, Succ[N], O] =
+ new At[H TCons T, Succ[N], O] {
+ def apply(l: H TCons T): O = {
+ val (_ TCons t) = l
+ a(t)
+ }
+ }
+}
+
+// An HMap is an Tuple with HEntry elements. We are reusing Tuple for it's nice syntax
+
+final case class HEntry[K, V](value: V)
+
+// Accessor type class to compute the element of type K in a HMap L -----------
+
+trait PhantomGet[K, M <: Tuple, I <: Nat] // extends PhantomAny
+
+object PhantomGet {
+ implicit def getHead[K, V, T <: Tuple]
+ : PhantomGet[K, HEntry[K, V] TCons T, Zero] = null
+
+ implicit def getTail[K, H, T <: Tuple, I <: Nat]
+ (implicit t: PhantomGet[K, T, I])
+ : PhantomGet[K, H TCons T, Succ[I]] = null
+}
+
+// Syntax ---------------------------------------------------------------------
+
+object syntax {
+ object hmap {
+ implicit class HmapGet[M <: Tuple](m: M) {
+ def get[K, V, I <: Nat](k: K)
+ (implicit
+ g: PhantomGet[k.type, M, I],
+ a: At[M, I, HEntry[k.type, V]]
+ ): V = a(m).value
+ }
+
+ def --[K, V](key: K, value: V) = HEntry[key.type, V](value)
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ import syntax.hmap._
+
+ val map1 =
+ TCons(HEntry[K = "name"]("foo"),
+ TCons(HEntry[K = "genre"](true),
+ TCons(HEntry[K = "moneyz"](123),
+ TCons(HEntry[K = "cat"]("bar"),
+ (TNil: TNil.type)))))
+
+ assert(map1.get("name") == "foo")
+ assert(map1.get("genre") == true)
+ assert(map1.get("moneyz") == 123)
+ assert(map1.get("cat") == "bar")
+
+ val map2 =
+ TCons(--("name" , "foo"),
+ TCons(--("genre" , true),
+ TCons(--("moneyz", 123),
+ TCons(--("cat" , "bar"),
+ TNil))))
+
+ assert(map2.get("name") == "foo")
+ assert(map2.get("genre") == true)
+ assert(map2.get("moneyz") == 123)
+ assert(map2.get("cat") == "bar")
+ }
+}
diff --git a/tests/run/i1573.check b/tests/run/i1573.check
new file mode 100644
index 000000000..d81cc0710
--- /dev/null
+++ b/tests/run/i1573.check
@@ -0,0 +1 @@
+42
diff --git a/tests/run/i1573.scala b/tests/run/i1573.scala
new file mode 100644
index 000000000..f9c28a9a0
--- /dev/null
+++ b/tests/run/i1573.scala
@@ -0,0 +1,9 @@
+
+object Test {
+
+ def main(args: Array[String]): Unit = {
+ println(Test.foo(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109))
+ }
+
+ def foo(p1: Int, p2: Int, p3: Int, p4: Int, p5: Int, p6: Int, p7: Int, p8: Int, p9: Int, p10: Int, p11: Int, p12: Int, p13: Int, p14: Int, p15: Int, p16: Int, p17: Int, p18: Int, p19: Int, p20: Int, p21: Int, p22: Int, p23: Int, p24: Int, p25: Int, p26: Int, p27: Int, p28: Int, p29: Int, p30: Int, p31: Int, p32: Int, p33: Int, p34: Int, p35: Int, p36: Int, p37: Int, p38: Int, p39: Int, p40: Int, p41: Int, p42: Int, p43: Int, p44: Int, p45: Int, p46: Int, p47: Int, p48: Int, p49: Int, p50: Int, p51: Int, p52: Int, p53: Int, p54: Int, p55: Int, p56: Int, p57: Int, p58: Int, p59: Int, p60: Int, p61: Int, p62: Int, p63: Int, p64: Int, p65: Int, p66: Int, p67: Int, p68: Int, p69: Int, p70: Int, p71: Int, p72: Int, p73: Int, p74: Int, p75: Int, p76: Int, p77: Int, p78: Int, p79: Int, p80: Int, p81: Int, p82: Int, p83: Int, p84: Int, p85: Int, p86: Int, p87: Int, p88: Int, p89: Int, p90: Int, p91: Int, p92: Int, p93: Int, p94: Int, p95: Int, p96: Int, p97: Int, p98: Int, p99: Int, p100: Int, p101: Int, p102: Int, p103: Int, p104: Int, p105: Int, p106: Int, p107: Int, p108: Int, p109: Int): Int = 42
+}
diff --git a/tests/run/i1960.scala b/tests/run/i1960.scala
new file mode 100644
index 000000000..a3d441d17
--- /dev/null
+++ b/tests/run/i1960.scala
@@ -0,0 +1,8 @@
+case class CC2[A, B](_1: A, _2: B)
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val CC2(_, CC2(a, _)) = CC2(0, CC2(1, 2))
+ assert(a == 1)
+ }
+}
diff --git a/tests/run/i2004.check b/tests/run/i2004.check
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/tests/run/i2004.check
@@ -0,0 +1 @@
+1
diff --git a/tests/run/i2004.scala b/tests/run/i2004.scala
new file mode 100644
index 000000000..ff21a6cc9
--- /dev/null
+++ b/tests/run/i2004.scala
@@ -0,0 +1,11 @@
+object Test {
+ def main(args: Array[String]) = {
+ val f: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int,Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) => Int =
+ {
+ (x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int, x19: Int, x20: Int, x21: Int, x22: Int, x23: Int, x24: Int, x25: Int, x26: Int) =>
+ x1
+ }
+ println(f.apply(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1))
+
+ }
+}
diff --git a/tests/run/i2077.check b/tests/run/i2077.check
new file mode 100644
index 000000000..45b983be3
--- /dev/null
+++ b/tests/run/i2077.check
@@ -0,0 +1 @@
+hi
diff --git a/tests/run/i2077.scala b/tests/run/i2077.scala
new file mode 100644
index 000000000..42b629b90
--- /dev/null
+++ b/tests/run/i2077.scala
@@ -0,0 +1,10 @@
+object Test {
+ inline val x = true
+ val y = if (x) 1 else 2 // reduced to val y = 1
+
+ def main(args: Array[String]): Unit =
+ if ({ println("hi"); true }) // cannot be reduced
+ 1
+ else
+ 2
+}
diff --git a/tests/run/i2147.check b/tests/run/i2147.check
new file mode 100644
index 000000000..f704ab00e
--- /dev/null
+++ b/tests/run/i2147.check
@@ -0,0 +1,3 @@
+before
+42
+lol
diff --git a/tests/run/i2147.scala b/tests/run/i2147.scala
new file mode 100644
index 000000000..f8e9f2181
--- /dev/null
+++ b/tests/run/i2147.scala
@@ -0,0 +1,7 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ println("before")
+ System.out.println("42")
+ println("lol")
+ }
+}
diff --git a/tests/run/i2156.scala b/tests/run/i2156.scala
new file mode 100644
index 000000000..12ce8fa88
--- /dev/null
+++ b/tests/run/i2156.scala
@@ -0,0 +1,37 @@
+class Outer {
+
+ case class Inner()
+
+ val inner: Inner = new Inner
+
+ def checkInstance(o: Outer) =
+ o.inner.isInstanceOf[this.Inner]
+
+ def checkPattern1(i: Any) =
+ i match {
+ case _: Inner => true
+ case _ => false
+ }
+
+ def checkPattern2(i: Any) =
+ i match {
+ case Inner() => true
+ case _ => false
+ }
+
+ def checkEquals(o: Outer) =
+ o.inner == inner
+}
+
+object Test {
+
+ def main(args: Array[String]) = {
+ val o1 = new Outer
+ val o2 = new Outer
+ assert(o1.checkInstance(o2)) // ok
+ assert(!o1.checkPattern1(o2.inner)) // ok under scalac, fails for dotc-compiled code
+ assert(!o1.checkPattern2(o2.inner)) // ok under scalac, fails for dotc-compiled code
+ assert(!o1.checkEquals(o2)) // ok under scalac, fails for dotc-compiled code
+ }
+}
+
diff --git a/tests/run/iterator-from.scala b/tests/run/iterator-from.scala
index 4f403680c..c7c0f9809 100644
--- a/tests/run/iterator-from.scala
+++ b/tests/run/iterator-from.scala
@@ -11,7 +11,9 @@ object Test extends dotty.runtime.LegacyApp {
val maxKey = 50
val maxValue = 50
- def testSet[A <% Ordered[A]](set: SortedSet[A], list: List[A]): Unit = {
+ implicit def convertIfView[A](x: A)(implicit view: A => Ordered[A]): Ordered[A] = view(x)
+
+ def testSet[A: Ordering](set: SortedSet[A], list: List[A]): Unit = {
val distinctSorted = list.distinct.sorted
assertEquals("Set size wasn't the same as list sze", set.size, distinctSorted.size)
@@ -24,7 +26,7 @@ object Test extends dotty.runtime.LegacyApp {
}
}
- def testMap[A <% Ordered[A], B](map: SortedMap[A, B], list: List[(A, B)]): Unit = {
+ def testMap[A: Ordering, B](map: SortedMap[A, B], list: List[(A, B)]): Unit = {
val distinctSorted = distinctByKey(list).sortBy(_._1)
assertEquals("Map size wasn't the same as list sze", map.size, distinctSorted.size)
diff --git a/tests/run/origins.check b/tests/run/origins.check
deleted file mode 100644
index 54d58296b..000000000
--- a/tests/run/origins.check
+++ /dev/null
@@ -1,6 +0,0 @@
-
->> Origins tag 'boop' logged 65 calls from 3 distinguished sources.
-
- 50 Test$.$anonfun$f3$1(origins.scala:16)
- 10 Test$.$anonfun$f2$1(origins.scala:15)
- 5 Test$.$anonfun$f1$1(origins.scala:14)
diff --git a/tests/run/origins.flags b/tests/run/origins.flags
deleted file mode 100644
index 690753d80..000000000
--- a/tests/run/origins.flags
+++ /dev/null
@@ -1 +0,0 @@
--no-specialization -Ydelambdafy:inline \ No newline at end of file
diff --git a/tests/run/origins.scala b/tests/run/origins.scala
deleted file mode 100644
index 6529351d3..000000000
--- a/tests/run/origins.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-import scala.reflect.internal.util.Origins
-
-package goxbox {
- object Socks {
- val origins = Origins("boop")
-
- def boop(x: Int): Int = origins { 5 }
- }
-}
-
-object Test {
- import goxbox.Socks.boop
-
- def f1() = 1 to 5 map boop
- def f2() = 1 to 10 map boop
- def f3() = 1 to 50 map boop
-
- def main(args: Array[String]): Unit = {
- f1() ; f2() ; f3()
- }
-}
diff --git a/tests/run/paramForwarding.check b/tests/run/paramForwarding.check
index c004a95be..e91447784 100644
--- a/tests/run/paramForwarding.check
+++ b/tests/run/paramForwarding.check
@@ -13,4 +13,4 @@ NonVal:
X:
private final int X.theValue$$local
Y:
-private final int Y.theValue$$local
+
diff --git a/tests/run/paramForwarding.scala b/tests/run/paramForwarding.scala
index 61466b621..6fe80a230 100644
--- a/tests/run/paramForwarding.scala
+++ b/tests/run/paramForwarding.scala
@@ -19,7 +19,7 @@ class Bz extends A(42) {
val theValueInBz = theValue
}
-// C does not contains a field C.theValue$$local, it contains
+// C does not contain a field C.theValue$$local, it contains
// a getter C.theValue() which only calls super.theValue()
class C(override val theValue: Int) extends A(theValue)
@@ -36,8 +36,8 @@ class NonVal(theValue: Int) extends A(theValue) {
// X.theValue() which overrides A.theValue()
class X(override val theValue: Int) extends NonVal(0)
-// Y contains a field Y.theValue$$local accessible using the getter
-// Y.theValue() which overrides A.theValue()
+// Y does not contain a field Y.theValue$$local, it contains
+// a getter Y.theValue() which only calls super.theValue()
class Y(override val theValue: Int) extends NonVal(theValue)
diff --git a/tests/run/paramForwarding_separate.check b/tests/run/paramForwarding_separate.check
new file mode 100644
index 000000000..8df0c3100
--- /dev/null
+++ b/tests/run/paramForwarding_separate.check
@@ -0,0 +1,6 @@
+# Fields in A:
+private final int A.member$$local
+# Fields in SubA:
+
+# Fields in B:
+
diff --git a/tests/run/paramForwarding_separate/A_1.scala b/tests/run/paramForwarding_separate/A_1.scala
new file mode 100644
index 000000000..86ebcad24
--- /dev/null
+++ b/tests/run/paramForwarding_separate/A_1.scala
@@ -0,0 +1,7 @@
+class A(val member: Int) {
+ def getAMember = member
+}
+
+class SubA(member: Int) extends A(member) {
+ def getSubAMember = member
+}
diff --git a/tests/run/paramForwarding_separate/B_2.scala b/tests/run/paramForwarding_separate/B_2.scala
new file mode 100644
index 000000000..7c13018b7
--- /dev/null
+++ b/tests/run/paramForwarding_separate/B_2.scala
@@ -0,0 +1,21 @@
+class B(member: Int) extends SubA(member) {
+ def getMember = member
+}
+
+object Test {
+ def printFields(cls: Class[_]) =
+ println(cls.getDeclaredFields.map(_.toString).sorted.deep.mkString("\n"))
+
+ def main(args: Array[String]): Unit = {
+ val a = new A(10)
+ val subA = new SubA(11)
+ val b = new B(12)
+
+ println("# Fields in A:")
+ printFields(classOf[A])
+ println("# Fields in SubA:")
+ printFields(classOf[SubA])
+ println("# Fields in B:")
+ printFields(classOf[B])
+ }
+}
diff --git a/tests/run/paramForwarding_together.check b/tests/run/paramForwarding_together.check
new file mode 100644
index 000000000..8df0c3100
--- /dev/null
+++ b/tests/run/paramForwarding_together.check
@@ -0,0 +1,6 @@
+# Fields in A:
+private final int A.member$$local
+# Fields in SubA:
+
+# Fields in B:
+
diff --git a/tests/run/paramForwarding_together.scala b/tests/run/paramForwarding_together.scala
new file mode 100644
index 000000000..670411e58
--- /dev/null
+++ b/tests/run/paramForwarding_together.scala
@@ -0,0 +1,29 @@
+class A(val member: Int) {
+ def getAMember = member
+}
+
+class SubA(member: Int) extends A(member) {
+ def getSubAMember = member
+}
+
+class B(member: Int) extends SubA(member) {
+ def getBMember = member
+}
+
+object Test {
+ def printFields(cls: Class[_]) =
+ println(cls.getDeclaredFields.map(_.toString).sorted.deep.mkString("\n"))
+
+ def main(args: Array[String]): Unit = {
+ val a = new A(10)
+ val subA = new SubA(11)
+ val b = new B(12)
+
+ println("# Fields in A:")
+ printFields(classOf[A])
+ println("# Fields in SubA:")
+ printFields(classOf[SubA])
+ println("# Fields in B:")
+ printFields(classOf[B])
+ }
+}
diff --git a/tests/run/paramForwarding_together_b.check b/tests/run/paramForwarding_together_b.check
new file mode 100644
index 000000000..8df0c3100
--- /dev/null
+++ b/tests/run/paramForwarding_together_b.check
@@ -0,0 +1,6 @@
+# Fields in A:
+private final int A.member$$local
+# Fields in SubA:
+
+# Fields in B:
+
diff --git a/tests/run/paramForwarding_together_b.scala b/tests/run/paramForwarding_together_b.scala
new file mode 100644
index 000000000..cb61cd11f
--- /dev/null
+++ b/tests/run/paramForwarding_together_b.scala
@@ -0,0 +1,30 @@
+class B(member: Int) extends SubA(member) {
+ def getBMember = member
+}
+
+class SubA(member: Int) extends A(member) {
+ def getSubAMember = member
+}
+
+class A(val member: Int) {
+ def getAMember = member
+}
+
+
+object Test {
+ def printFields(cls: Class[_]) =
+ println(cls.getDeclaredFields.map(_.toString).sorted.deep.mkString("\n"))
+
+ def main(args: Array[String]): Unit = {
+ val a = new A(10)
+ val subA = new SubA(11)
+ val b = new B(12)
+
+ println("# Fields in A:")
+ printFields(classOf[A])
+ println("# Fields in SubA:")
+ printFields(classOf[SubA])
+ println("# Fields in B:")
+ printFields(classOf[B])
+ }
+}
diff --git a/tests/run/puzzler54.scala b/tests/run/puzzler54.scala
new file mode 100644
index 000000000..9dd4cbb47
--- /dev/null
+++ b/tests/run/puzzler54.scala
@@ -0,0 +1,13 @@
+// Scala Puzzler 54
+object Test {
+ case class Card(number: Int, suit: String = "clubs") {
+ val value = (number % 13) + 1 // ace = 1, king = 13
+ def isInDeck(implicit deck: List[Card]) = deck contains this
+ }
+
+ def main(args: Array[String]) = {
+ implicit val deck = List(Card(1, "clubs"))
+ implicit def intToCard(n: Int): Card = Card(n)
+ assert(1.isInDeck)
+ }
+}
diff --git a/tests/run/shutdownhooks.check b/tests/run/shutdownhooks.check
deleted file mode 100644
index 29956956e..000000000
--- a/tests/run/shutdownhooks.check
+++ /dev/null
@@ -1,3 +0,0 @@
-Fooblitzky!
-main#shutdown.
-Test#shutdown.
diff --git a/tests/run/shutdownhooks.scala b/tests/run/shutdownhooks.scala
deleted file mode 100644
index 5f512a391..000000000
--- a/tests/run/shutdownhooks.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-object Test {
- scala.sys.addShutdownHook {
- Thread.sleep(1000)
- println("Test#shutdown.")
- }
-
- def daemon() = {
- val t = new Thread {
- override def run(): Unit = {
- Thread.sleep(10000)
- println("Hallelujah!") // should not see this
- }
- }
- t.setDaemon(true)
- t.start()
- t
- }
-
- def nonDaemon() = {
- val t = new Thread {
- override def run(): Unit = {
- Thread.sleep(100)
- println("Fooblitzky!")
- }
- }
- t.start()
- t
- }
-
- def main(args: Array[String]): Unit = {
- daemon()
- nonDaemon()
- scala.sys.addShutdownHook {
- println("main#shutdown.")
- }
- }
-}
diff --git a/tests/run/static/i2054.scala b/tests/run/static/i2054.scala
new file mode 100644
index 000000000..576e42d79
--- /dev/null
+++ b/tests/run/static/i2054.scala
@@ -0,0 +1,13 @@
+import scala.annotation.static
+
+class Test
+
+object Test {
+ @static def test(n: Int): Int = {
+ List(3).map(_ + 2)
+ n
+ }
+
+ def main(args: Array[String]): Unit = test(3)
+}
+
diff --git a/tests/run/t4400.scala b/tests/run/t4400.scala
new file mode 100644
index 000000000..04ae6722e
--- /dev/null
+++ b/tests/run/t4400.scala
@@ -0,0 +1,35 @@
+final class Outer {
+
+
+
+ sealed trait Inner
+
+
+
+ final case class Inner1(foo: Int) extends Inner
+
+
+
+ val inner: Outer#Inner = Inner1(0)
+
+
+
+ def bar = inner match {
+
+ case Inner1(i) => i
+
+ }
+
+}
+
+
+
+object Test {
+
+ def main(args: Array[String]): Unit = {
+ val s = (new Outer).bar
+ assert(s == 0)
+ }
+
+}
+
diff --git a/tests/run/t8280.check b/tests/run/t8280.check
index 44c51f5aa..b5885df48 100644
--- a/tests/run/t8280.check
+++ b/tests/run/t8280.check
@@ -1,7 +1,6 @@
-Int
-Int
Long
Int
Int
Int
Int
+Int
diff --git a/tests/run/t8280.scala b/tests/run/t8280.scala
index f433dcc32..5fcbad0a3 100644
--- a/tests/run/t8280.scala
+++ b/tests/run/t8280.scala
@@ -37,7 +37,8 @@ object Moop1 {
implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" }
implicit val f2: Long => String = _ => "Long"
- println(5: String)
+ //println(5: String)
+ // This picked f1 before, but is now disallowed since subtypes of functions are no longer implicit conversions
}
}
@@ -73,14 +74,14 @@ object Moop3 {
// Dotty deviation. This fails for Dotty with ambiguity error for similar reasons as ob1.
}
object ob2 {
- implicit val f1: Int => String = _ => "Int"
+ implicit val f1: ImplicitConverter[Int, String] = _ => "Int"
implicit def f2(x: Long): String = "Long"
println(5: String)
}
object ob3 {
- implicit val f1: Int => String = _ => "Int"
- implicit val f2: Long => String = _ => "Long"
+ implicit val f1: ImplicitConverter[Int, String] = _ => "Int"
+ implicit val f2: ImplicitConverter[Long, String] = _ => "Long"
println(5: String)
}
diff --git a/tests/run/variable-pattern-access.check b/tests/run/variable-pattern-access.check
new file mode 100644
index 000000000..1039f6a25
--- /dev/null
+++ b/tests/run/variable-pattern-access.check
@@ -0,0 +1,7 @@
+# Fields of A:
+private final int A.a$$local
+private final int A.b$$local
+private final scala.Tuple2 A.$1$
+# Methods of A:
+public int A.a()
+public int A.b()
diff --git a/tests/run/variable-pattern-access.scala b/tests/run/variable-pattern-access.scala
new file mode 100644
index 000000000..1d27b3e42
--- /dev/null
+++ b/tests/run/variable-pattern-access.scala
@@ -0,0 +1,16 @@
+class A {
+ val (a, b) = (1, 2)
+}
+object Test {
+ def printFields(cls: Class[_]) =
+ println(cls.getDeclaredFields.map(_.toString).sorted.deep.mkString("\n"))
+ def printMethods(cls: Class[_]) =
+ println(cls.getDeclaredMethods.map(_.toString).sorted.deep.mkString("\n"))
+
+ def main(args: Array[String]): Unit = {
+ println("# Fields of A:")
+ printFields(classOf[A])
+ println("# Methods of A:")
+ printMethods(classOf[A])
+ }
+}