We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c5a3b5c commit ade3492Copy full SHA for ade3492
tests/neg/i6565.scala
@@ -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