File tree 5 files changed +39
-4
lines changed 5 files changed +39
-4
lines changed Original file line number Diff line number Diff line change @@ -517,6 +517,12 @@ object desugar {
517
517
}
518
518
}
519
519
520
+ /** Expand variable identifier x to x @ _ */
521
+ def patternVar (tree : Tree )(implicit ctx : Context ) = {
522
+ val Ident (name) = tree
523
+ Bind (name, Ident (nme.WILDCARD )).withPos(tree.pos)
524
+ }
525
+
520
526
def defTree (tree : Tree )(implicit ctx : Context ): Tree = tree match {
521
527
case tree : ValDef => valDef(tree)
522
528
case tree : TypeDef => if (tree.isClassDef) classDef(tree) else typeDef(tree)
Original file line number Diff line number Diff line change @@ -253,8 +253,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
253
253
if (ctx.mode is Mode .Pattern ) {
254
254
if (name == nme.WILDCARD )
255
255
return tree.withType(pt)
256
- if (isVarPattern(tree))
257
- return typed(untpd. Bind (name, untpd. Ident (nme. WILDCARD )).withPos( tree.pos ), pt)
256
+ if (isVarPattern(tree) && name.isTermName )
257
+ return typed(desugar.patternVar( tree), pt)
258
258
}
259
259
260
260
val saved = importedFromRoot
@@ -848,7 +848,12 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
848
848
args = args.take(tparams.length)
849
849
}
850
850
def typedArg (arg : untpd.Tree , tparam : Symbol ) = {
851
- val arg1 = typed(arg, if (ctx.mode is Mode .Pattern ) tparam.info else WildcardType )
851
+ val (desugaredArg, argPt) =
852
+ if (ctx.mode is Mode .Pattern )
853
+ (if (isVarPattern(arg)) desugar.patternVar(arg) else arg, tparam.info)
854
+ else
855
+ (arg, WildcardType )
856
+ val arg1 = typed(desugaredArg, argPt)
852
857
adaptTypeArg(arg1, if (tparam.isCompleted) tparam.info else WildcardType )
853
858
}
854
859
val args1 = args.zipWithConserve(tparams)(typedArg(_, _)).asInstanceOf [List [Tree ]]
Original file line number Diff line number Diff line change 86
86
#./scala-scala/src/library/scala/collection/mutable/IndexedSeq.scala
87
87
#./scala-scala/src/library/scala/collection/mutable/ListBuffer.scala
88
88
89
+ ./scala-scala/src/library/scala/collection/mutable/ArrayBuilder.scala
90
+
89
91
./scala-scala/src/library/scala/collection/immutable/Stack.scala
90
92
./scala-scala/src/library/scala/collection/immutable/StringLike.scala
91
93
./scala-scala/src/library/scala/collection/immutable/StringOps.scala
167
169
./scala-scala/src/library/scala/collection/SeqExtractors.scala
168
170
169
171
# https://github.com/lampepfl/dotty/issues/945
170
- # ./scala-scala/src/library/scala/collection/SeqLike.scala
172
+ ./scala-scala/src/library/scala/collection/SeqLike.scala
171
173
172
174
./scala-scala/src/library/scala/collection/SeqProxy.scala
173
175
./scala-scala/src/library/scala/collection/SeqProxyLike.scala
Original file line number Diff line number Diff line change
1
+ object Test {
2
+
3
+ class c {
4
+
5
+ private var x : Int = 0
6
+
7
+ override def equals (other : Any ) = other match {
8
+ case o : c => x == o.x
9
+ case xs : List [c] => false
10
+ case ys : List [d18383] => false
11
+ case _ => false
12
+ }
13
+
14
+
15
+ }
16
+ }
Original file line number Diff line number Diff line change @@ -16,4 +16,10 @@ object implicits2 {
16
16
17
17
val x : scala.collection.immutable.WrappedString = " abc"
18
18
19
+ implicit val (xx : String , y : Int ) = (" a" , 22 )
20
+
21
+ def main (args : Array [String ]) = {
22
+ println(implicitly[String ])
23
+ println(implicitly[Int ])
24
+ }
19
25
}
You can’t perform that action at this time.
0 commit comments