FIR: tolerate comparison of an intersection of incompatible types

Previously, if user compares an `it<String, Int>` with `String`, the
checker reports it since the flattened types `[String, Int, Int]` are
incompatible. But technically, before flattening, the intersection type
actually contain the other side, so they should really be compatible.
This commit is contained in:
Tianyu Geng
2021-07-26 10:07:29 -07:00
committed by teamcityserver
parent b5ea811b9f
commit e242ad955b
3 changed files with 24 additions and 10 deletions
@@ -32,8 +32,8 @@ fun useEn2(x: En2) = x
fun bar(x: Any) {
if (x is En && x is En2) {
when (x) {
<!INCOMPATIBLE_TYPES!>En.A<!> -> useEn(x)
<!INCOMPATIBLE_TYPES!>En2.D<!> -> useEn2(x)
En.A -> useEn(x)
En2.D -> useEn2(x)
else -> {}
}
}