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