Skip to content

Commit a3b6646

Browse files
committed
Fix auto-suggest breakage and expand test
1 parent 9a02f8e commit a3b6646

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ trait Applications extends Compatibility {
651651
* argument trees.
652652
*/
653653
class ApplicableToTrees(methRef: TermRef, args: List[Tree], resultType: Type)(implicit ctx: Context)
654-
extends TestApplication(methRef, methRef.widenTermRefExpr, args, resultType) {
654+
extends TestApplication(methRef, methRef.widen, args, resultType) {
655655
def argType(arg: Tree, formal: Type): Type = normalize(arg.tpe, formal)
656656
def treeToArg(arg: Tree): Tree = arg
657657
def isVarArg(arg: Tree): Boolean = tpd.isWildcardStarArg(arg)

tests/pos/i4561.scala

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
object abc {
1+
object abc:
22
trait Test0
3-
trait Test1 { def apply(f: Int => Int): Unit }
3+
trait Test1[T]:
4+
def apply(f: T => T): Unit
5+
def apply(s: String): Unit
46

57
def v: Test0 = ???
6-
def v[T]: Test1 = ???
7-
//def v[T](x: String): Test0 = ???
8+
def v[T]: Test1[Int] = ???
89

9-
v[Int]{ v => v }
10-
}
10+
def w: Test0 = ???
11+
def w[T]: Test1[T] = ???
12+
def w[T](x: String): Test1[T] = ???
13+
14+
v[Any](x => x)
15+
val v1: Test0 = v
16+
v(x => x + 1)
17+
18+
w[Int](_ + 1)
19+
// w[_ + 1) // error: `+` is not a member of Any
20+
w[Int]("x")(_ + 1)

0 commit comments

Comments
 (0)