Skip to content

Commit ddc6d6d

Browse files
nicolasstuckinerush
authored andcommitted
Workaround warining of unchecked outer references
The outer reference in this type test cannot be checked at run time
1 parent 1c43ccf commit ddc6d6d

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

compiler/src/dotty/tools/dotc/Run.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class Run(comp: Compiler, ictx: Context) {
143143
}
144144

145145
private sealed trait PrintedTree
146-
private final case class SomePrintedTree(phase: String, tree: String) extends PrintedTree
146+
private /*final*/ case class SomePrintedTree(phase: String, tree: String) extends PrintedTree
147147
private object NoPrintedTree extends PrintedTree
148148

149149
private def printTree(last: PrintedTree)(implicit ctx: Context): PrintedTree = {

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ class PatternMatcherOld extends MiniPhase with DenotTransformer {
286286
}
287287
}
288288
}
289-
final case class Suppression(exhaustive: Boolean, unreachable: Boolean)
289+
/*final*/ case class Suppression(exhaustive: Boolean, unreachable: Boolean)
290290
object Suppression {
291291
val NoSuppression = Suppression(false, false)
292292
}
@@ -1061,7 +1061,7 @@ class PatternMatcherOld extends MiniPhase with DenotTransformer {
10611061
case _ => BoundTree(freshSym(tree.pos, pt, PatMatPName), tree)
10621062
}
10631063

1064-
final case class BoundTree(binder: Symbol, tree: Tree) {
1064+
/*final*/ case class BoundTree(binder: Symbol, tree: Tree) {
10651065
private lazy val extractor = ExtractorCall(tree, binder)
10661066

10671067
def pos = tree.pos
@@ -1179,7 +1179,7 @@ class PatternMatcherOld extends MiniPhase with DenotTransformer {
11791179
}
11801180

11811181
// a list of TreeMakers that encode `patTree`, and a list of arguments for recursive invocations of `translatePattern` to encode its subpatterns
1182-
final case class TranslationStep(makers: List[TreeMaker], subpatterns: List[BoundTree]) {
1182+
/*final*/ case class TranslationStep(makers: List[TreeMaker], subpatterns: List[BoundTree]) {
11831183
def merge(f: BoundTree => List[TreeMaker]): List[TreeMaker] = makers ::: (subpatterns flatMap f)
11841184
override def toString = if (subpatterns.isEmpty) "" else subpatterns.mkString("(", ", ", ")")
11851185
}
@@ -1611,7 +1611,7 @@ class PatternMatcherOld extends MiniPhase with DenotTransformer {
16111611
override def toString = "<none>"
16121612
}
16131613

1614-
final case class Patterns(fixed: List[Pattern], star: Pattern) {
1614+
/*final*/ case class Patterns(fixed: List[Pattern], star: Pattern) {
16151615
def hasStar = star != NoPattern
16161616
def starArity = if (hasStar) 1 else 0
16171617
def nonStarArity = fixed.length
@@ -1645,7 +1645,7 @@ class PatternMatcherOld extends MiniPhase with DenotTransformer {
16451645
* @param fixed The non-sequence types which are extracted
16461646
* @param repeated The sequence type which is extracted
16471647
*/
1648-
final case class Extractor(whole: Type, fixed: List[Type], repeated: Repeated) {
1648+
/*final*/ case class Extractor(whole: Type, fixed: List[Type], repeated: Repeated) {
16491649
require(whole != NoType, s"expandTypes($whole, $fixed, $repeated)")
16501650

16511651
def prodArity = fixed.length
@@ -1666,7 +1666,7 @@ class PatternMatcherOld extends MiniPhase with DenotTransformer {
16661666
override def toString = "%s => %s".format(whole, offeringString)
16671667
}
16681668

1669-
final case class TypedPat(pat: Pattern, tpe: Type) {
1669+
/*final*/ case class TypedPat(pat: Pattern, tpe: Type) {
16701670
override def toString = s"$pat: $tpe"
16711671
}
16721672

@@ -1677,7 +1677,7 @@ class PatternMatcherOld extends MiniPhase with DenotTransformer {
16771677
* sequence which can populate at least <elementArity> patterns.
16781678
* < 0: There are more products than patterns: compile time error.
16791679
*/
1680-
final case class Aligned(patterns: Patterns, extractor: Extractor) {
1680+
/*final*/ case class Aligned(patterns: Patterns, extractor: Extractor) {
16811681
def elementArity = patterns.nonStarArity - prodArity
16821682
def prodArity = extractor.prodArity
16831683
def starArity = patterns.starArity

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
128128
/** A group of files that may all be compiled together, with the same flags
129129
* and output directory
130130
*/
131-
private final case class JointCompilationSource(
131+
private case class JointCompilationSource(
132132
name: String,
133133
files: Array[JFile],
134134
flags: TestFlags,
@@ -143,7 +143,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
143143
/** A test source whose files will be compiled separately according to their
144144
* suffix `_X`
145145
*/
146-
private final case class SeparateCompilationSource(
146+
private case class SeparateCompilationSource(
147147
name: String,
148148
dir: JFile,
149149
flags: TestFlags,

0 commit comments

Comments
 (0)