Skip to content

Commit 81745e2

Browse files
committed
Fix a problem due to different type inference
1 parent a3cc938 commit 81745e2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,12 @@ trait Applications extends Compatibility { self: Typer =>
433433

434434
/** Subclass of Application for type checking an Apply node with typed arguments. */
435435
class ApplyToTyped(app: untpd.Apply, fun: Tree, methRef: TermRef, args: List[Tree], resultType: Type)(implicit ctx: Context)
436-
extends TypedApply(app, fun, methRef, args, resultType) {
437-
def typedArg(arg: Tree, formal: Type): TypedArg = arg
436+
extends TypedApply[Type](app, fun, methRef, args, resultType) {
437+
// Dotty deviation: Dotc infers Untyped for the supercall. This seems to be according to the rules
438+
// (of both Scala and Dotty). Untyped is legal, and a subtype of Typed, whereas TypeApply
439+
// is invariant in the type parameter, so the minimal type should be inferred. But then typedArg does
440+
// not match the abstract method in Application and an abstract class error results.
441+
def typedArg(arg: tpd.Tree, formal: Type): TypedArg = arg
438442
def treeToArg(arg: Tree): Tree = arg
439443
}
440444

0 commit comments

Comments
 (0)