@@ -1014,20 +1014,12 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1014
1014
}
1015
1015
}
1016
1016
1017
- private def noResultProto (pt : Type ) = pt match {
1018
- case pt : FunProto => pt.derivedFunProto(pt.args, WildcardType , pt.typer) // drop result type, because views are disabled
1019
- case _ => pt
1020
- }
1021
-
1022
- /** Add apply node or implicit conversions. Three strategies are tried, and the first
1023
- * that is succesful is picked. If none of the strategies are succesful, continues with
1017
+ /** Add apply node or implicit conversions. Two strategies are tried, and the first
1018
+ * that is succesful is picked. If neither of the strategies are succesful, continues with
1024
1019
* `fallBack`.
1025
1020
*
1026
1021
* 1st strategy: Try to insert `.apply` so that the result conforms to prototype `pt`.
1027
- * 2nd strategy: If the expected type is a FunProto with a non-wildcard resulttype,
1028
- * try to match against the FunProto with wildcard resulttype (this allows for an additional
1029
- * implicit conversion on the result).
1030
- * 3rd stratgey: If tree is a select `qual.name`, try to insert an implicit conversion
1022
+ * 2nd stratgey: If tree is a select `qual.name`, try to insert an implicit conversion
1031
1023
* around the qualifier part `qual` so that the result conforms to the expected type
1032
1024
* with wildcard result type.
1033
1025
*/
@@ -1036,23 +1028,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1036
1028
val sel = typedSelect(untpd.Select (untpd.TypedSplice (tree), nme.apply), pt)
1037
1029
if (sel.tpe.isError) sel else adapt(sel, pt)
1038
1030
} { (failedTree, failedState) =>
1039
- val tree1 = tryInsertImplicits (tree, pt)
1031
+ val tree1 = tryInsertImplicitOnQualifier (tree, pt)
1040
1032
if (tree1 eq tree) fallBack(failedTree, failedState)
1041
- else adapt(tree1, noResultProto(pt) )
1033
+ else adapt(tree1, pt )
1042
1034
}
1043
1035
1044
- def tryInsertImplicits (tree : Tree , pt : ProtoType )(implicit ctx : Context ): Tree = {
1045
- val normalizedProto = noResultProto(pt)
1046
- if (normalizedProto eq pt) tryInsertImplicitOnQualifier(tree, pt)
1047
- else tryEither { implicit ctx =>
1048
- val tree1 = adaptInterpolated(tree, normalizedProto, EmptyTree )
1049
- if (tree1 eq tree) ctx.error(" no progress" )
1050
- tree1
1051
- } { (_, _) =>
1052
- tryInsertImplicitOnQualifier(tree, normalizedProto)
1053
- }
1054
- }
1055
-
1056
1036
/** If this tree is a select node `qual.name`, try to insert an implicit conversion
1057
1037
* `c` around `qual` so that `c(qual).name` conforms to `pt`. If that fails
1058
1038
* return `tree` itself.
0 commit comments