Skip to content

Commit dd8a2af

Browse files
committed
Fix unchecked PatDef in compiler
1 parent 9b8f1c5 commit dd8a2af

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

compiler/src/dotty/tools/dotc/transform/ContextFunctionResults.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ object ContextFunctionResults:
4646
def contextResultCount(sym: Symbol)(using Context): Int =
4747
sym.getAnnotation(defn.ContextResultCountAnnot) match
4848
case Some(annot) =>
49-
val ast.Trees.Literal(Constant(crCount: Int)) :: Nil: @unchecked = annot.arguments
49+
val ast.Trees.Literal(Constant(crCount: Int)) :: Nil = annot.arguments: @unchecked
5050
crCount
5151
case none => 0
5252

@@ -73,7 +73,7 @@ object ContextFunctionResults:
7373
def contextParamCount(tp: Type, crCount: Int): Int =
7474
if crCount == 0 then 0
7575
else
76-
val defn.ContextFunctionType(params, resTpe, isErased): @unchecked = tp
76+
val defn.ContextFunctionType(params, resTpe, isErased) = tp: @unchecked
7777
val rest = contextParamCount(resTpe, crCount - 1)
7878
if isErased then rest else params.length + rest
7979

@@ -106,7 +106,7 @@ object ContextFunctionResults:
106106
def missingCR(tp: Type, crCount: Int): (Type, Int) =
107107
if crCount == 0 then (tp, 0)
108108
else
109-
val defn.ContextFunctionType(formals, resTpe, isErased): @unchecked = tp
109+
val defn.ContextFunctionType(formals, resTpe, isErased) = tp: @unchecked
110110
val result @ (rt, nparams) = missingCR(resTpe, crCount - 1)
111111
assert(nparams <= paramCount)
112112
if nparams == paramCount || isErased then result

compiler/src/dotty/tools/dotc/transform/Erasure.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,15 +490,15 @@ object Erasure {
490490
def abstracted(args: List[Tree], tp: Type, pt: Type)(using Context): Tree =
491491
if args.length < targetLength then
492492
try
493-
val defn.ContextFunctionType(argTpes, resTpe, isErased): @unchecked = tp
493+
val defn.ContextFunctionType(argTpes, resTpe, isErased) = tp: @unchecked
494494
if isErased then abstracted(args, resTpe, pt)
495495
else
496496
val anonFun = newSymbol(
497497
ctx.owner, nme.ANON_FUN, Flags.Synthetic | Flags.Method,
498498
MethodType(argTpes, resTpe), coord = tree.span.endPos)
499499
anonFun.info = transformInfo(anonFun, anonFun.info)
500500
def lambdaBody(refss: List[List[Tree]]) =
501-
val refs :: Nil : @unchecked = refss
501+
val refs :: Nil = refss: @unchecked
502502
val expandedRefs = refs.map(_.withSpan(tree.span.endPos)) match
503503
case (bunchedParam @ Ident(nme.ALLARGS)) :: Nil =>
504504
argTpes.indices.toList.map(n =>

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1877,7 +1877,7 @@ class Typer extends Namer
18771877
case _ =>
18781878
var name = tree.name
18791879
if (name == nme.WILDCARD && tree.mods.is(Given)) {
1880-
val Typed(_, tpt): @unchecked = tree.body
1880+
val Typed(_, tpt) = tree.body: @unchecked
18811881
name = desugar.inventGivenOrExtensionName(tpt)
18821882
}
18831883
if (name == nme.WILDCARD) body1

0 commit comments

Comments
 (0)