File tree Expand file tree Collapse file tree 4 files changed +48
-50
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 4 files changed +48
-50
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ object TypeErasure {
44
44
val sym = tp.symbol
45
45
sym.isClass &&
46
46
sym != defn.AnyClass && sym != defn.ArrayClass &&
47
- ! defn.isUnimplementedFunctionClass(sym)
47
+ ! defn.isUnimplementedFunctionClass(sym) && ! defn.isImplicitFunctionClass(sym)
48
48
case _ : TermRef =>
49
49
true
50
50
case JavaArrayType (elem) =>
Original file line number Diff line number Diff line change @@ -345,21 +345,23 @@ object Erasure extends TypeTestsCasts{
345
345
override def typedSelect (tree : untpd.Select , pt : Type )(implicit ctx : Context ): Tree = {
346
346
347
347
def mapOwner (sym : Symbol ): Symbol = {
348
- val owner = sym.owner
349
- if ((owner eq defn.AnyClass ) || (owner eq defn.AnyValClass )) {
350
- assert(sym.isConstructor, s " ${sym.showLocated}" )
351
- defn.ObjectClass
352
- }
353
- else if (defn.isUnimplementedFunctionClass(owner))
354
- defn.FunctionXXLClass
355
- else
356
- owner
348
+ def recur (owner : Symbol ): Symbol =
349
+ if ((owner eq defn.AnyClass ) || (owner eq defn.AnyValClass )) {
350
+ assert(sym.isConstructor, s " ${sym.showLocated}" )
351
+ defn.ObjectClass
352
+ } else if (defn.isUnimplementedFunctionClass(owner))
353
+ defn.FunctionXXLClass
354
+ else if (defn.isImplicitFunctionClass(owner))
355
+ recur(defn.FunctionClass (owner.name.functionArity))
356
+ else
357
+ owner
358
+ recur(sym.owner)
357
359
}
358
360
359
- var sym = tree.symbol
360
- val owner = mapOwner(sym )
361
- if (owner ne sym .owner) sym = owner.info.decl(sym .name).symbol
362
- assert(sym.exists, owner )
361
+ val origSym = tree.symbol
362
+ val owner = mapOwner(origSym )
363
+ val sym = if (owner eq origSym .owner) origSym else owner.info.decl(origSym .name).symbol
364
+ assert(sym.exists, origSym.showLocated )
363
365
364
366
def select (qual : Tree , sym : Symbol ): Tree = {
365
367
val name = tree.typeOpt match {
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ def main (args : Array [String ]) = {
3
+
4
+ implicit val world : String = " world!"
5
+
6
+ val i1 = (implicit (s : String ) => s.length > 2 )
7
+ val i2 = {implicit (s : String ) => s.length > 2 }
8
+
9
+ assert(i1)
10
+ assert(i2)
11
+
12
+ val x : implicit String => Boolean = { implicit (s : String ) => s.length > 2 }
13
+
14
+ val xx : implicit (String , Int ) => Int = implicit (x : String , y : Int ) => x.length + y
15
+
16
+ val y : String => Boolean = x
17
+
18
+ val yy : (String , Int ) => Any = xx
19
+
20
+ val b = x(" hello" )
21
+
22
+ val b1 : Boolean = b
23
+
24
+ val bi = x
25
+
26
+ val bi1 : Boolean = bi
27
+
28
+ val c = xx(" hh" , 22 )
29
+
30
+ val c1 : Int = c
31
+ }
32
+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments