Skip to content

Commit ade3492

Browse files
committed
Fix #6565: Add test case
1 parent c5a3b5c commit ade3492

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/neg/i6565.scala

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Err
2+
3+
type Lifted[A] = Err | A
4+
5+
def point[O](o: O): Lifted[O] = o
6+
def (o: Lifted[O]) map [O, U] (f: O => U): Lifted[U] = ???
7+
def (o: Lifted[O]) flatMap [O, U] (f: O => Lifted[U]): Lifted[U] = ???
8+
9+
val error: Err = Err()
10+
11+
lazy val ok: Lifted[String] = { // ok despite map returning a union
12+
point("a").map(_ => if true then "foo" else error) // error
13+
}
14+
15+
lazy val bad: Lifted[String] = { // found Lifted[Object]
16+
point("a").flatMap(_ => point("b").map(_ => if true then "foo" else error)) // error
17+
}

0 commit comments

Comments
 (0)