Skip to content

Commit 1541fa0

Browse files
committed
Defer the pattern matching phase until after refchecks
Continuing from scala#6552. The motivation is run the pickler phase earlier, as its intermediate output can be used as an input to downstream compilation in a pipelined build architecture. (cherry picked from commit 8fd8e36)
1 parent a979681 commit 1541fa0

File tree

8 files changed

+36
-33
lines changed

8 files changed

+36
-33
lines changed

src/compiler/scala/tools/nsc/Global.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -470,16 +470,6 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
470470
val global: Global.this.type = Global.this
471471
} with Analyzer
472472

473-
// phaseName = "patmat"
474-
object patmat extends {
475-
val global: Global.this.type = Global.this
476-
// patmat does not need to run before the superaccessors phase, because
477-
// patmat never emits `this.x` where `x` is a ParamAccessor.
478-
// (However, patmat does need to run before outer accessors generation).
479-
val runsAfter = List("superaccessors")
480-
val runsRightAfter = None
481-
} with PatternMatching
482-
483473
// phaseName = "superaccessors"
484474
object superAccessors extends {
485475
val global: Global.this.type = Global.this
@@ -491,7 +481,7 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
491481
// phaseName = "extmethods"
492482
object extensionMethods extends {
493483
val global: Global.this.type = Global.this
494-
val runsAfter = List("patmat")
484+
val runsAfter = List("superaccessors")
495485
val runsRightAfter = None
496486
} with ExtensionMethods
497487

@@ -509,10 +499,20 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
509499
val runsRightAfter = None
510500
} with RefChecks
511501

502+
// phaseName = "patmat"
503+
object patmat extends {
504+
val global: Global.this.type = Global.this
505+
// patmat does not need to run before the superaccessors phase, because
506+
// patmat never emits `this.x` where `x` is a ParamAccessor.
507+
// (However, patmat does need to run before outer accessors generation).
508+
val runsAfter = List("refchecks")
509+
val runsRightAfter = None
510+
} with PatternMatching
511+
512512
// phaseName = "uncurry"
513513
override object uncurry extends {
514514
val global: Global.this.type = Global.this
515-
val runsAfter = List("refchecks")
515+
val runsAfter = List("patmat")
516516
val runsRightAfter = None
517517
} with UnCurry
518518

test/files/neg/t6446-additional.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
packageobjects 3 load package objects
66
typer 4 the meat and potatoes: type the trees
77
superaccessors 5 add super accessors in traits and nested classes
8-
patmat 6 translate match expressions
9-
extmethods 7 add extension methods for inline classes
10-
pickler 8 serialize symbol tables
11-
refchecks 9 reference/override checking, translate nested objects
8+
extmethods 6 add extension methods for inline classes
9+
pickler 7 serialize symbol tables
10+
refchecks 8 reference/override checking, translate nested objects
11+
patmat 9 translate match expressions
1212
uncurry 10 uncurry, translate function values to anonymous classes
1313
fields 11 synthesize accessors and fields, add bitmaps for lazy vals
1414
tailcalls 12 replace tail calls by jumps

test/files/neg/t6446-missing.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ Error: unable to load class: t6446.Ploogin
66
packageobjects 3 load package objects
77
typer 4 the meat and potatoes: type the trees
88
superaccessors 5 add super accessors in traits and nested classes
9-
patmat 6 translate match expressions
10-
extmethods 7 add extension methods for inline classes
11-
pickler 8 serialize symbol tables
12-
refchecks 9 reference/override checking, translate nested objects
9+
extmethods 6 add extension methods for inline classes
10+
pickler 7 serialize symbol tables
11+
refchecks 8 reference/override checking, translate nested objects
12+
patmat 9 translate match expressions
1313
uncurry 10 uncurry, translate function values to anonymous classes
1414
fields 11 synthesize accessors and fields, add bitmaps for lazy vals
1515
tailcalls 12 replace tail calls by jumps

test/files/neg/t6446-show-phases.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
packageobjects 3 load package objects
66
typer 4 the meat and potatoes: type the trees
77
superaccessors 5 add super accessors in traits and nested classes
8-
patmat 6 translate match expressions
9-
extmethods 7 add extension methods for inline classes
10-
pickler 8 serialize symbol tables
11-
refchecks 9 reference/override checking, translate nested objects
8+
extmethods 6 add extension methods for inline classes
9+
pickler 7 serialize symbol tables
10+
refchecks 8 reference/override checking, translate nested objects
11+
patmat 9 translate match expressions
1212
uncurry 10 uncurry, translate function values to anonymous classes
1313
fields 11 synthesize accessors and fields, add bitmaps for lazy vals
1414
tailcalls 12 replace tail calls by jumps

test/files/neg/t7494-no-options.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ error: Error: ploogin takes no options
66
packageobjects 3 load package objects
77
typer 4 the meat and potatoes: type the trees
88
superaccessors 5 add super accessors in traits and nested classes
9-
patmat 6 translate match expressions
10-
extmethods 7 add extension methods for inline classes
11-
pickler 8 serialize symbol tables
12-
refchecks 9 reference/override checking, translate nested objects
9+
extmethods 6 add extension methods for inline classes
10+
pickler 7 serialize symbol tables
11+
refchecks 8 reference/override checking, translate nested objects
12+
patmat 9 translate match expressions
1313
uncurry 10 uncurry, translate function values to anonymous classes
1414
fields 11 synthesize accessors and fields, add bitmaps for lazy vals
1515
tailcalls 12 replace tail calls by jumps

test/files/run/programmatic-main.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
packageobjects 3 load package objects
66
typer 4 the meat and potatoes: type the trees
77
superaccessors 5 add super accessors in traits and nested classes
8-
patmat 6 translate match expressions
9-
extmethods 7 add extension methods for inline classes
10-
pickler 8 serialize symbol tables
11-
refchecks 9 reference/override checking, translate nested objects
8+
extmethods 6 add extension methods for inline classes
9+
pickler 7 serialize symbol tables
10+
refchecks 8 reference/override checking, translate nested objects
11+
patmat 9 translate match expressions
1212
uncurry 10 uncurry, translate function values to anonymous classes
1313
fields 11 synthesize accessors and fields, add bitmaps for lazy vals
1414
tailcalls 12 replace tail calls by jumps

test/files/run/t1434.check

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
t1434.scala:7: warning: comparing values of types Null and Null using `!=' will always yield false
2+
case a: A[_] if(a.op != null) => "with op"
3+
^

test/files/run/t6288.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[106][106][106]Case3.super.<init>();
66
[13]()
77
};
8-
[21]def unapply([29]z: [32]<type: [32]scala.Any>): [21]Option[Int] = [56][52][52]scala.Some.apply[[52]Int]([57]-1);
8+
[21]def unapply([29]z: [32]<type: [32]scala.Any>): [21]Option[Int] = [56][52][52]new [52]Some[Int]([57]-1);
99
[64]{
1010
[64]case <synthetic> val x1: [64]String = [64]"";
1111
[64]case5()[84]{

0 commit comments

Comments
 (0)