We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f674c18 commit 8a2158cCopy full SHA for 8a2158c
tests/pos/depfun.scala
@@ -0,0 +1,17 @@
1
+// The following test is derived from scala/reflect/TypeTest.scala, but using
2
+// a dependent function instead of a dependent SAM. It shows that the special treatment
3
+// using a DependentTypeTree is not needed for plain function types.
4
+// But for SAM types, the treatment is needed, otherwise TypeTest.scala does
5
+// not typecheck. Todo: Figure out the reason for this difference.
6
+object Test:
7
+
8
+ type F[S, T] = (x: S) => Option[x.type & T]
9
10
+ /** Trivial type test that always succeeds */
11
+ def identity[T]: F[T, T] = Some(_)
12
13
+ val x: 1 = 1
14
+ val y = identity(x)
15
+ val z: Option[1] = y
16
17
0 commit comments