@@ -5596,8 +5596,11 @@ export class Compiler extends DiagnosticEmitter {
5596
5596
}
5597
5597
return this . module . unreachable ( ) ;
5598
5598
}
5599
- assert ( indexedSet . signature . parameterTypes . length == 2 ) ; // parser must guarantee this
5600
- targetType = indexedSet . signature . parameterTypes [ 1 ] ; // 2nd parameter is the element
5599
+ let parameterTypes = indexedSet . signature . parameterTypes ;
5600
+
5601
+ assert ( parameterTypes . length == 2 ) ; // parser must guarantee this
5602
+ targetType = parameterTypes [ 1 ] ; // 2nd parameter is the element
5603
+
5601
5604
if ( indexedSet . hasDecorator ( DecoratorFlags . UNSAFE ) ) this . checkUnsafe ( expression ) ;
5602
5605
if ( ! isUnchecked && this . options . pedantic ) {
5603
5606
this . pedantic (
@@ -5788,7 +5791,19 @@ export class Compiler extends DiagnosticEmitter {
5788
5791
thisType ,
5789
5792
Constraints . CONV_IMPLICIT | Constraints . IS_THIS
5790
5793
) ;
5791
- let elementExpr = this . compileExpression ( assert ( indexExpression ) , Type . i32 , Constraints . CONV_IMPLICIT ) ;
5794
+ let setterIndexType = setterInstance . signature . parameterTypes [ 0 ] ;
5795
+ let getterIndexType = getterInstance . signature . parameterTypes [ 0 ] ;
5796
+ if ( ! setterIndexType . equals ( getterIndexType ) ) {
5797
+ this . errorRelated (
5798
+ DiagnosticCode . Index_signature_accessors_in_type_0_differ_in_types ,
5799
+ getterInstance . identifierAndSignatureRange ,
5800
+ setterInstance . identifierAndSignatureRange ,
5801
+ classInstance . internalName ,
5802
+ ) ;
5803
+ this . currentType = tee ? getterInstance . signature . returnType : Type . void ;
5804
+ return module . unreachable ( ) ;
5805
+ }
5806
+ let elementExpr = this . compileExpression ( assert ( indexExpression ) , setterIndexType , Constraints . CONV_IMPLICIT ) ;
5792
5807
let elementType = this . currentType ;
5793
5808
if ( tee ) {
5794
5809
let tempTarget = flow . getTempLocal ( thisType ) ;
0 commit comments