File tree Expand file tree Collapse file tree 7 files changed +538
-0
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 7 files changed +538
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ class Compiler {
63
63
new HoistSuperArgs , // Hoist complex arguments of supercalls to enclosing scope
64
64
new ClassOf ), // Expand `Predef.classOf` calls.
65
65
List (new TryCatchPatterns , // Compile cases in try/catch
66
+ new PatMat ,
66
67
new PatternMatcher , // Compile pattern matches
67
68
new ExplicitOuter , // Add accessors to outer classes from nested ones.
68
69
new ExplicitSelf , // Make references to non-trivial self types explicit as casts
Original file line number Diff line number Diff line change @@ -682,6 +682,12 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
682
682
def select (name : Name )(implicit ctx : Context ): Select =
683
683
Select (tree, name)
684
684
685
+ /** A select node with the given selector name such that the designated
686
+ * member satisfies predicate `p`. Useful for disambiguating overloaded members.
687
+ */
688
+ def select (name : Name , p : Symbol => Boolean )(implicit ctx : Context ): Select =
689
+ select(tree.tpe.member(name).suchThat(p).symbol)
690
+
685
691
/** A select node with the given type */
686
692
def select (tp : NamedType )(implicit ctx : Context ): Select =
687
693
untpd.Select (tree, tp.name).withType(tp)
Original file line number Diff line number Diff line change @@ -32,5 +32,6 @@ object Printers {
32
32
val pickling : Printer = noPrinter
33
33
val inlining : Printer = noPrinter
34
34
val exhaustivity : Printer = noPrinter
35
+ val patmatch : Printer = new Printer
35
36
val simplify : Printer = noPrinter
36
37
}
Original file line number Diff line number Diff line change @@ -373,6 +373,10 @@ class Definitions {
373
373
def Seq_apply (implicit ctx : Context ) = Seq_applyR .symbol
374
374
lazy val Seq_headR = SeqClass .requiredMethodRef(nme.head)
375
375
def Seq_head (implicit ctx : Context ) = Seq_headR .symbol
376
+ lazy val Seq_dropR = SeqClass .requiredMethodRef(nme.drop)
377
+ def Seq_drop (implicit ctx : Context ) = Seq_dropR .symbol
378
+ lazy val Seq_lengthCompareR = SeqClass .requiredMethodRef(nme.lengthCompare)
379
+ def Seq_lengthCompare (implicit ctx : Context ) = Seq_lengthCompareR .symbol
376
380
377
381
lazy val ArrayType : TypeRef = ctx.requiredClassRef(" scala.Array" )
378
382
def ArrayClass (implicit ctx : Context ) = ArrayType .symbol.asClass
You can’t perform that action at this time.
0 commit comments