From 8fce073e47a7490632a6132cbf9e7b6cffa5546b Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Thu, 18 Oct 2018 21:31:30 +0200 Subject: [PATCH] Add regression tests for #1593 --- tests/neg/isRef.scala | 13 +++++++++++++ tests/pos/isRef.scala | 12 ++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/neg/isRef.scala create mode 100644 tests/pos/isRef.scala diff --git a/tests/neg/isRef.scala b/tests/neg/isRef.scala new file mode 100644 index 000000000000..c8ad1aae51ae --- /dev/null +++ b/tests/neg/isRef.scala @@ -0,0 +1,13 @@ +trait Foo { + type A = (Any { type T = Int }) + type B = (Any { type S = String }) + def a: A + def b: B + def aandb: A & B = b // error: found: B, required: A & B +} +trait Foo2 { + type A[_] + type B[_] + def b: B[Int] + def aandb: A[Int] & B[Int] = b // error: found: B[Int], required: A[Int] & B[Int] +} diff --git a/tests/pos/isRef.scala b/tests/pos/isRef.scala new file mode 100644 index 000000000000..f3e3ce0d0af8 --- /dev/null +++ b/tests/pos/isRef.scala @@ -0,0 +1,12 @@ +trait Foo { + type A = (Any { type T = Int }) + type B = (Any { type S = String }) + def b: B + def aorb: A | B = b +} +trait Foo2 { + type A[_] + type B[_] + def b: B[Int] + def aorb: A[Int] | B[Int] = b +}