Skip to content

Commit 642c390

Browse files
committed
fix rogue diagnostic on varargs calls
1 parent fb62154 commit 642c390

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

src/compiler.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6653,6 +6653,9 @@ export class Compiler extends DiagnosticEmitter {
66536653
thisArg: ExpressionRef = 0,
66546654
immediatelyDropped: bool = false
66556655
): ExpressionRef {
6656+
if (instance.is(CommonFlags.VIRTUAL)) {
6657+
this.virtualCalls.add(instance);
6658+
}
66566659
var module = this.module;
66576660
var numArguments = operands ? operands.length : 0;
66586661
var signature = instance.signature;
@@ -7282,7 +7285,7 @@ export class Compiler extends DiagnosticEmitter {
72827285
));
72837286
continue;
72847287
}
7285-
let resolved = this.resolver.lookupExpression(initializer, instance.flow, parameterTypes[i]);
7288+
let resolved = this.resolver.lookupExpression(initializer, instance.flow, parameterTypes[i], ReportMode.SWALLOW);
72867289
if (resolved) {
72877290
if (resolved.kind == ElementKind.GLOBAL) {
72887291
let global = <Global>resolved;

src/program.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3689,7 +3689,7 @@ export class Class extends TypedElement {
36893689
}
36903690

36913691
/** Tests if this class potentially forms a reference cycle to another one. */
3692-
private cyclesTo(other: Class, except: Set<Class> = new Set<Class>()): bool {
3692+
private cyclesTo(other: Class, except: Set<Class> = new Set()): bool {
36933693
// TODO: The pure RC paper describes acyclic data structures as classes that may contain
36943694
//
36953695
// - scalars

src/resolver.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -665,17 +665,19 @@ export class Resolver extends DiagnosticEmitter {
665665
}
666666
var argumentCount = typeArgumentNodes ? typeArgumentNodes.length : 0;
667667
if (argumentCount < minParameterCount || argumentCount > maxParameterCount) {
668-
this.error(
669-
DiagnosticCode.Expected_0_type_arguments_but_got_1,
670-
argumentCount
671-
? Range.join(
672-
typeArgumentNodes![0].range,
673-
typeArgumentNodes![argumentCount - 1].range
674-
)
675-
: alternativeReportNode!.range,
676-
(argumentCount < minParameterCount ? minParameterCount : maxParameterCount).toString(),
677-
argumentCount.toString()
678-
);
668+
if (reportMode == ReportMode.REPORT) {
669+
this.error(
670+
DiagnosticCode.Expected_0_type_arguments_but_got_1,
671+
argumentCount
672+
? Range.join(
673+
typeArgumentNodes![0].range,
674+
typeArgumentNodes![argumentCount - 1].range
675+
)
676+
: alternativeReportNode!.range,
677+
(argumentCount < minParameterCount ? minParameterCount : maxParameterCount).toString(),
678+
argumentCount.toString()
679+
);
680+
}
679681
return null;
680682
}
681683
var typeArguments = new Array<Type>(maxParameterCount);

0 commit comments

Comments
 (0)