Skip to content

Commit f177d96

Browse files
authored
PolyFunction desugar: Don't copy type flags to parameter (#16891)
Fixes #16871
2 parents 6c241d3 + bdd56dd commit f177d96

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1732,7 +1732,7 @@ object desugar {
17321732

17331733
val applyVParams = vargs.zipWithIndex.map {
17341734
case (p: ValDef, _) => p.withAddedFlags(mods.flags)
1735-
case (p, n) => makeSyntheticParameter(n + 1, p).withAddedFlags(mods.flags)
1735+
case (p, n) => makeSyntheticParameter(n + 1, p).withAddedFlags(mods.flags.toTermFlags)
17361736
}
17371737
RefinedTypeTree(polyFunctionTpt, List(
17381738
DefDef(nme.apply, applyTParams :: applyVParams :: Nil, res, EmptyTree).withFlags(Synthetic)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import scala.language.experimental.captureChecking
2+
3+
val f: [X] => Int => Int = [X] => (x: Int) => x

0 commit comments

Comments
 (0)