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.
transparent inline def unapply
2 parents 827af90 + 11feb72 commit 66981bcCopy full SHA for 66981bc
compiler/src/dotty/tools/dotc/typer/Applications.scala
@@ -1413,7 +1413,8 @@ trait Applications extends Compatibility {
1413
report.error(em"Structural unapply is not supported", unapplyFn.srcPos)
1414
(unapplyFn, unapplyAppCall)
1415
case Apply(fn, `dummyArg` :: Nil) =>
1416
- val inlinedUnapplyFn = Inlines.inlinedUnapplyFun(fn)
+ val inlinedUnapplyFn = withoutMode(Mode.Pattern):
1417
+ Inlines.inlinedUnapplyFun(fn)
1418
(inlinedUnapplyFn, inlinedUnapplyFn.appliedToArgs(`dummyArg` :: Nil))
1419
case Apply(fn, args) =>
1420
val (fn1, app) = rec(fn)
tests/pos/i20107.scala
@@ -0,0 +1,6 @@
1
+object foo:
2
+ transparent inline def unapply[F](e: F): Option[F] = Some(e.asInstanceOf[F])
3
+
4
+class A:
5
+ def test(x: Int) = x match
6
+ case foo(e) => e
0 commit comments