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
1 parent a7f00e2 commit 5672caaCopy full SHA for 5672caa
compiler/src/dotty/tools/dotc/typer/Applications.scala
@@ -1429,7 +1429,8 @@ trait Applications extends Compatibility {
1429
report.error(em"Structural unapply is not supported", unapplyFn.srcPos)
1430
(unapplyFn, unapplyAppCall)
1431
case Apply(fn, `dummyArg` :: Nil) =>
1432
- val inlinedUnapplyFn = Inlines.inlinedUnapplyFun(fn)
+ val inlinedUnapplyFn = withoutMode(Mode.Pattern):
1433
+ Inlines.inlinedUnapplyFun(fn)
1434
(inlinedUnapplyFn, inlinedUnapplyFn.appliedToArgs(`dummyArg` :: Nil))
1435
case Apply(fn, args) =>
1436
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