aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/subtyping.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-11-16 12:52:29 +0100
committerMartin Odersky <odersky@gmail.com>2014-11-16 12:54:46 +0100
commit3c43871ed5acec9315f84e3a481adbaf5fb24897 (patch)
tree783d734b3b6f40e4aa177c47166d5c11c91c71c5 /tests/pos/subtyping.scala
parent4cb35ef98fef6a1c2826568c95117fd7ce84bdad (diff)
downloaddotty-3c43871ed5acec9315f84e3a481adbaf5fb24897.tar.gz
dotty-3c43871ed5acec9315f84e3a481adbaf5fb24897.tar.bz2
dotty-3c43871ed5acec9315f84e3a481adbaf5fb24897.zip
Try to avoid overconstraining when comparing and/or types
See comments in eitherIsSubType for an explanation what the problem is. Some test cases are in subtyping.scala
Diffstat (limited to 'tests/pos/subtyping.scala')
-rw-r--r--tests/pos/subtyping.scala20
1 files changed, 15 insertions, 5 deletions
diff --git a/tests/pos/subtyping.scala b/tests/pos/subtyping.scala
index a5e156780..c8d7a82a9 100644
--- a/tests/pos/subtyping.scala
+++ b/tests/pos/subtyping.scala
@@ -1,6 +1,16 @@
-class A {
- def test1(): Unit = {
- implicitly[this.type <:< this.type]
- implicitly[this.type <:< A]
- }
+object test {
+
+ class B
+ class C
+
+ def tag1[T](x: T): String & T = ???
+ def tag2[T](x: T): T & String = ???
+
+ val x1: Int & String = tag1(0)
+ val x2: Int & String = tag2(0)
+ val x3: String & Int = tag1(0)
+ val x4: String & Int = tag2(0)
+
}
+
+