@@ -97,7 +97,9 @@ trait ContextErrors {
97
97
98
98
def issueTypeError (err : AbsTypeError )(implicit context : Context ): Unit = { context.issue(err) }
99
99
100
- def typeErrorMsg (found : Type , req : Type ) = " type mismatch" + foundReqMsg(found, req)
100
+ def typeErrorMsg (context : Context , found : Type , req : Type ) =
101
+ if (context.openImplicits.nonEmpty && ! settings.XlogImplicits .value) " type mismatch"
102
+ else " type mismatch" + foundReqMsg(found, req)
101
103
}
102
104
103
105
def notAnyRefMessage (found : Type ): String = {
@@ -208,7 +210,7 @@ trait ContextErrors {
208
210
assert(! foundType.isErroneous, s " AdaptTypeError - foundType is Erroneous: $foundType" )
209
211
assert(! req.isErroneous, s " AdaptTypeError - req is Erroneous: $req" )
210
212
211
- issueNormalTypeError(callee, withAddendum(callee.pos)(typeErrorMsg(foundType, req)))
213
+ issueNormalTypeError(callee, withAddendum(callee.pos)(typeErrorMsg(context, foundType, req)))
212
214
infer.explainTypes(foundType, req)
213
215
}
214
216
@@ -1106,7 +1108,7 @@ trait ContextErrors {
1106
1108
}
1107
1109
1108
1110
def NoBestExprAlternativeError (tree : Tree , pt : Type , lastTry : Boolean ) = {
1109
- issueNormalTypeError(tree, withAddendum(tree.pos)(typeErrorMsg(tree.symbol.tpe, pt)))
1111
+ issueNormalTypeError(tree, withAddendum(tree.pos)(typeErrorMsg(context, tree.symbol.tpe, pt)))
1110
1112
setErrorOnLastTry(lastTry, tree)
1111
1113
}
1112
1114
@@ -1373,7 +1375,7 @@ trait ContextErrors {
1373
1375
sm """ |Note that implicit conversions are not applicable because they are ambiguous:
1374
1376
| ${coreMsg}are possible conversion functions from $found to $req"""
1375
1377
}
1376
- typeErrorMsg(found, req) + (
1378
+ typeErrorMsg(context, found, req) + (
1377
1379
if (explanation == " " ) " " else " \n " + explanation
1378
1380
)
1379
1381
}
0 commit comments