File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,8 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
93
93
checkAnnotations(tree)
94
94
healInfo(tree, tree.srcPos)
95
95
super .transform(tree)
96
+ case tree : UnApply =>
97
+ super .transform(tree).withType(healTypeOfTerm(tree.srcPos)(tree.tpe))
96
98
case tree : TypeDef if tree.symbol.is(Case ) && level > 0 =>
97
99
report.error(reporting.CaseClassInInlinedCode (tree), tree)
98
100
super .transform(tree)
Original file line number Diff line number Diff line change
1
+ import scala .quoted ._
2
+ def takeOptionImpl1 [T ](using Quotes , Type [T ]): Unit = ' {
3
+ (??? : Option [T ]) match
4
+ case Some (t) => ???
5
+ }
6
+
7
+ def takeOptionImpl2 [T ](using Quotes , Type [T ]): Unit = ' {
8
+ (??? : Option [T ]) match
9
+ case Some (_) | None => ???
10
+ }
11
+
12
+ def takeOptionImpl [T ](o : Expr [Option [T ]], default : Expr [T ])(using Quotes , Type [T ]): Expr [T ] = ' {
13
+ $o match {
14
+ case Some (t1) => t1
15
+ case None : Option [T ] => $default
16
+ }
17
+ }
18
+
19
+ inline def takeOption [T ](inline o : Option [T ], inline default : T ) = $ {takeOptionImpl(' o , ' default )}
You can’t perform that action at this time.
0 commit comments