aboutsummaryrefslogtreecommitdiff
path: root/tests/repl
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-08-07 18:12:13 +0200
committerMartin Odersky <odersky@gmail.com>2016-08-16 17:34:42 +0200
commitb3d4fd94f24b961715dce15d7d46fcdd32f7dd69 (patch)
treeefb390524c8e59d51202e6645a4a9eaa48e13afa /tests/repl
parent8d4d9a363d90cc24bd79b18ea2ef7cba6a746bef (diff)
downloaddotty-b3d4fd94f24b961715dce15d7d46fcdd32f7dd69.tar.gz
dotty-b3d4fd94f24b961715dce15d7d46fcdd32f7dd69.tar.bz2
dotty-b3d4fd94f24b961715dce15d7d46fcdd32f7dd69.zip
Fix readLine in TestREPL to align with Ammonite reader
Needs to read several input lines at once. Enables repl test of new error messages.
Diffstat (limited to 'tests/repl')
-rw-r--r--tests/repl/errmsgs.check74
1 files changed, 74 insertions, 0 deletions
diff --git a/tests/repl/errmsgs.check b/tests/repl/errmsgs.check
new file mode 100644
index 000000000..d8e863a28
--- /dev/null
+++ b/tests/repl/errmsgs.check
@@ -0,0 +1,74 @@
+scala> class Inv[T](x: T)
+defined class Inv
+scala> val x: List[String] = List(1)
+<console>:4: error: type mismatch:
+ found : Int(1)
+ required: String
+val x: List[String] = List(1)
+ ^
+scala> val y: List[List[String]] = List(List(1))
+<console>:4: error: type mismatch:
+ found : Int(1)
+ required: String
+val y: List[List[String]] = List(List(1))
+ ^
+scala> val z: (List[String], List[Int]) = (List(1), List("a"))
+<console>:4: error: type mismatch:
+ found : Int(1)
+ required: String
+val z: (List[String], List[Int]) = (List(1), List("a"))
+ ^
+<console>:4: error: type mismatch:
+ found : String("a")
+ required: Int
+val z: (List[String], List[Int]) = (List(1), List("a"))
+ ^
+scala> val a: Inv[String] = new Inv(new Inv(1))
+<console>:5: error: type mismatch:
+ found : Inv[T]
+ required: String
+
+where T is a type variable with constraint >: Int(1)
+
+val a: Inv[String] = new Inv(new Inv(1))
+ ^
+scala> val b: Inv[String] = new Inv(1)
+<console>:5: error: type mismatch:
+ found : Int(1)
+ required: String
+val b: Inv[String] = new Inv(1)
+ ^
+scala> abstract class C {
+ type T
+ val x: T
+ val s: Unit = {
+ type T = String
+ var y: T = x
+ locally {
+ def f() = {
+ type T = Int
+ val z: T = y
+ }
+ f()
+ }
+ }
+ }
+<console>:9: error: type mismatch:
+ found : C.this.T(C.this.x)
+ required: T'
+
+where T is a type in class C
+ T' is a type in the initalizer of value s which is an alias of String
+
+ var y: T = x
+ ^
+<console>:13: error: type mismatch:
+ found : T(y)
+ required: T'
+
+where T is a type in the initalizer of value s which is an alias of String
+ T' is a type in method f which is an alias of Int
+
+ val z: T = y
+ ^
+scala> :quit