Skip to content

Commit 84f2e41

Browse files
authored
Merge pull request #8446 from dotty-staging/fix-#6565
Fix #6565: Add test case
2 parents 2a05b8d + ade3492 commit 84f2e41

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/neg/i6565.scala

Lines changed: 17 additions & 0 deletions
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)