File tree 3 files changed +39
-1
lines changed
compiler/src/dotty/tools/dotc/typer
3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,7 @@ object ErrorReporting {
167
167
*/
168
168
def userDefinedErrorString (raw : String , paramNames : List [String ], args : List [Type ]): String = {
169
169
def translate (name : String ): Option [String ] = {
170
+ assert(paramNames.length == args.length)
170
171
val idx = paramNames.indexOf(name)
171
172
if (idx >= 0 ) Some (quoteReplacement(ex " ${args(idx)}" )) else None
172
173
}
Original file line number Diff line number Diff line change @@ -1217,7 +1217,7 @@ trait Implicits { self: Typer =>
1217
1217
err.userDefinedErrorString(
1218
1218
raw,
1219
1219
pt.typeSymbol.typeParams.map(_.name.unexpandedName.toString),
1220
- pt.widenExpr.argInfos))
1220
+ pt.widenExpr.dropDependentRefinement. argInfos))
1221
1221
1222
1222
def hiddenImplicitsAddendum : String =
1223
1223
Original file line number Diff line number Diff line change
1
+ trait MapImpl {
2
+ type Key
3
+ type Value
4
+ type Map
5
+ val lookup : Map => Key => Value
6
+ }
7
+ import scala .collection .immutable .HashMap
8
+
9
+ class HashMapImpl [K , V ] extends MapImpl {
10
+ type Key = K
11
+ type Value = V
12
+ type Map = HashMap [K , V ]
13
+ val lookup : Map => Key => Value = m => k => m(k)
14
+ }
15
+
16
+ object Foo {
17
+ val Server0 :
18
+ (mImpl : MapImpl ) => mImpl.Map => mImpl.Key => mImpl.Value
19
+ = mImpl => mImpl.lookup
20
+ val Client :
21
+ (server : (mImpl : MapImpl { type Key = String ; type Value = Int }) => mImpl.Map => String => Int ) => Int =
22
+ server => server(HashMapImpl [String , Int ])(HashMap ())(" test lookup key" )
23
+ val Client1 :
24
+ (server : (mImpl : MapImpl { type Key = String ; type Value = Int }) => mImpl.Map => String => Int ) => Int =
25
+ server => server(??? : (HashMapImpl [String , Int ]))(??? )(" test lookup key" )
26
+ val Client2 :
27
+ (server : (mImpl : MapImpl { type Key = String ; type Value = Int }) => mImpl.Map => String => Int ) => Int =
28
+ server => server(??? )(??? )(" test lookup key" )
29
+ val Server1 : (mImpl : MapImpl {type Key = String ; type Value = Int }) => mImpl.Map => String => Int =
30
+ mImpl => Server0 (mImpl)
31
+ implicitly[(mImpl : MapImpl {type Key = String ; type Value = Int }) => mImpl.Map => String => Int <:< (mImpl : MapImpl ) => mImpl.Map => mImpl.Key => mImpl.Value ] // error
32
+ implicitly[(mImpl : MapImpl {type Key = String ; type Value = Int }) => mImpl.Map => mImpl.Key => mImpl.Value <:< (mImpl : MapImpl ) => mImpl.Map => mImpl.Key => mImpl.Value ] // error
33
+
34
+ val Result1 : Int = Client (Server0 ) // error
35
+ val Result2 : Int = Client (Server1 )
36
+ val Result3 : Int = Client (mImpl => Server0 (mImpl))
37
+ }
You can’t perform that action at this time.
0 commit comments