Skip to content

Commit bde7278

Browse files
authored
fix: Fix assert when calling a setter property (#1802)
1 parent 82eb7b3 commit bde7278

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/compiler.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6335,7 +6335,17 @@ export class Compiler extends DiagnosticEmitter {
63356335
}
63366336
case ElementKind.PROPERTY: {
63376337
let propertyInstance = <Property>target;
6338-
let getterInstance = assert(propertyInstance.getterInstance);
6338+
let getterInstance = propertyInstance.getterInstance;
6339+
let type = assert(this.resolver.getTypeOfElement(target));
6340+
6341+
if (!getterInstance) {
6342+
this.error(
6343+
DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,
6344+
expression.range, type.toString()
6345+
);
6346+
return module.unreachable();
6347+
}
6348+
63396349
let thisArg: ExpressionRef = 0;
63406350
if (propertyInstance.is(CommonFlags.INSTANCE)) {
63416351
thisArg = this.compileExpression(

src/resolver.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,6 @@ export class Resolver extends DiagnosticEmitter {
877877
}
878878
if (isTypedElement(kind)) {
879879
let type = (<TypedElement>element).type;
880-
assert(type != Type.void);
881880
let classReference = type.getClassOrWrapper(this.program);
882881
if (classReference) {
883882
let wrappedType = classReference.wrappedType;

0 commit comments

Comments
 (0)