@@ -428,7 +428,7 @@ export class Compiler extends DiagnosticEmitter {
428428 if ( cyclicClasses . size ) {
429429 if ( options . pedantic ) {
430430 for ( let classInstance of cyclicClasses ) {
431- this . info (
431+ this . pedantic (
432432 DiagnosticCode . Type_0_is_cyclic_Module_will_include_deferred_garbage_collection ,
433433 classInstance . identifierNode . range , classInstance . internalName
434434 ) ;
@@ -504,7 +504,7 @@ export class Compiler extends DiagnosticEmitter {
504504 if ( options . importTable ) {
505505 module . addTableImport ( "0" , "env" , "table" ) ;
506506 if ( options . pedantic && options . willOptimize ) {
507- this . warning (
507+ this . pedantic (
508508 DiagnosticCode . Importing_the_table_disables_some_indirect_call_optimizations ,
509509 null
510510 ) ;
@@ -513,7 +513,7 @@ export class Compiler extends DiagnosticEmitter {
513513 if ( options . exportTable ) {
514514 module . addTableExport ( "0" , ExportNames . table ) ;
515515 if ( options . pedantic && options . willOptimize ) {
516- this . warning (
516+ this . pedantic (
517517 DiagnosticCode . Exporting_the_table_disables_some_indirect_call_optimizations ,
518518 null
519519 ) ;
@@ -5578,6 +5578,12 @@ export class Compiler extends DiagnosticEmitter {
55785578 assert ( indexedSet . signature . parameterTypes . length == 2 ) ; // parser must guarantee this
55795579 targetType = indexedSet . signature . parameterTypes [ 1 ] ; // 2nd parameter is the element
55805580 if ( indexedSet . hasDecorator ( DecoratorFlags . UNSAFE ) ) this . checkUnsafe ( expression ) ;
5581+ if ( ! isUnchecked && this . options . pedantic ) {
5582+ this . pedantic (
5583+ DiagnosticCode . Indexed_access_may_involve_bounds_checking ,
5584+ expression . range
5585+ ) ;
5586+ }
55815587 break ;
55825588 }
55835589 default : {
@@ -7220,11 +7226,18 @@ export class Compiler extends DiagnosticEmitter {
72207226 if ( targetType . is ( TypeFlags . REFERENCE ) ) {
72217227 let classReference = targetType . classReference ;
72227228 if ( classReference ) {
7223- let indexedGet = classReference . lookupOverload ( OperatorKind . INDEXED_GET , this . currentFlow . is ( FlowFlags . UNCHECKED_CONTEXT ) ) ;
7229+ let isUnchecked = this . currentFlow . is ( FlowFlags . UNCHECKED_CONTEXT ) ;
7230+ let indexedGet = classReference . lookupOverload ( OperatorKind . INDEXED_GET , isUnchecked ) ;
72247231 if ( indexedGet ) {
72257232 let thisArg = this . compileExpression ( targetExpression , classReference . type ,
72267233 Constraints . CONV_IMPLICIT
72277234 ) ;
7235+ if ( ! isUnchecked && this . options . pedantic ) {
7236+ this . pedantic (
7237+ DiagnosticCode . Indexed_access_may_involve_bounds_checking ,
7238+ expression . range
7239+ ) ;
7240+ }
72287241 return this . compileCallDirect ( indexedGet , [
72297242 expression . elementExpression
72307243 ] , expression , thisArg , constraints ) ;
@@ -7671,6 +7684,12 @@ export class Compiler extends DiagnosticEmitter {
76717684 ] , expression )
76727685 ) ;
76737686 flow . freeTempLocal ( temp ) ;
7687+ if ( this . options . pedantic ) {
7688+ this . pedantic (
7689+ DiagnosticCode . Expression_compiles_to_a_dynamic_check_at_runtime ,
7690+ expression . range
7691+ ) ;
7692+ }
76747693 return ret ;
76757694 } else {
76767695 this . error (
0 commit comments