diff --git a/internal/api/encoder/encoder_test.go b/internal/api/encoder/encoder_test.go index 95459fbefa..4d1be79d36 100644 --- a/internal/api/encoder/encoder_test.go +++ b/internal/api/encoder/encoder_test.go @@ -17,16 +17,11 @@ import ( "gotest.tools/v3/assert" ) -var parseCompilerOptions = core.SourceFileAffectingCompilerOptions{ - EmitScriptTarget: core.ScriptTargetLatest, -} - func TestEncodeSourceFile(t *testing.T) { t.Parallel() sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ - FileName: "/test.ts", - Path: "/test.ts", - CompilerOptions: parseCompilerOptions, + FileName: "/test.ts", + Path: "/test.ts", }, "import { bar } from \"bar\";\nexport function foo(a: string, b: string): any {}\nfoo();", core.ScriptKindTS) t.Run("baseline", func(t *testing.T) { t.Parallel() @@ -46,9 +41,8 @@ func BenchmarkEncodeSourceFile(b *testing.B) { fileContent, err := os.ReadFile(filePath) assert.NilError(b, err) sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ - FileName: "/checker.ts", - Path: "/checker.ts", - CompilerOptions: parseCompilerOptions, + FileName: "/checker.ts", + Path: "/checker.ts", }, string(fileContent), core.ScriptKindTS) for b.Loop() { diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 58205a3135..269c512ea4 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -10053,10 +10053,6 @@ func (node *SourceFile) ParseOptions() SourceFileParseOptions { return node.parseOptions } -func (node *SourceFile) LanguageVersion() core.ScriptTarget { - return node.parseOptions.CompilerOptions.EmitScriptTarget -} - func (node *SourceFile) Text() string { return node.text } diff --git a/internal/astnav/tokens_test.go b/internal/astnav/tokens_test.go index 30f425c080..9c237dafee 100644 --- a/internal/astnav/tokens_test.go +++ b/internal/astnav/tokens_test.go @@ -25,10 +25,6 @@ var testFiles = []string{ filepath.Join(repo.TypeScriptSubmodulePath, "src/services/mapCode.ts"), } -var parseCompilerOptions = core.SourceFileAffectingCompilerOptions{ - EmitScriptTarget: core.ScriptTargetLatest, -} - func TestGetTokenAtPosition(t *testing.T) { t.Parallel() repo.SkipIfNoTypeScriptSubmodule(t) @@ -57,9 +53,8 @@ func TestGetTokenAtPosition(t *testing.T) { } ` file := parser.ParseSourceFile(ast.SourceFileParseOptions{ - FileName: "/file.ts", - Path: "/file.ts", - CompilerOptions: parseCompilerOptions, + FileName: "/file.ts", + Path: "/file.ts", }, fileText, core.ScriptKindTS) assert.Equal(t, astnav.GetTokenAtPosition(file, 0), astnav.GetTokenAtPosition(file, 0)) }) @@ -96,9 +91,8 @@ func baselineTokens(t *testing.T, testName string, includeEOF bool, getTSTokens } tsTokens := getTSTokens(string(fileText), positions) file := parser.ParseSourceFile(ast.SourceFileParseOptions{ - FileName: "/file.ts", - Path: "/file.ts", - CompilerOptions: parseCompilerOptions, + FileName: "/file.ts", + Path: "/file.ts", }, string(fileText), core.ScriptKindTS) var output strings.Builder @@ -433,9 +427,8 @@ export function isAnyDirectorySeparator(charCode: number): boolean { t.Run(testCase.name, func(t *testing.T) { t.Parallel() file := parser.ParseSourceFile(ast.SourceFileParseOptions{ - FileName: "/file.ts", - Path: "/file.ts", - CompilerOptions: parseCompilerOptions, + FileName: "/file.ts", + Path: "/file.ts", }, testCase.fileContent, core.ScriptKindTS) token := astnav.FindPrecedingToken(file, testCase.position) assert.Equal(t, token.Kind, testCase.expectedKind) diff --git a/internal/binder/binder.go b/internal/binder/binder.go index 2b24232767..9f241bf8a1 100644 --- a/internal/binder/binder.go +++ b/internal/binder/binder.go @@ -42,7 +42,6 @@ const ( type Binder struct { file *ast.SourceFile - languageVersion core.ScriptTarget bindFunc func(*ast.Node) bool unreachableFlow *ast.FlowNode reportedUnreachableFlow *ast.FlowNode @@ -121,7 +120,6 @@ func bindSourceFile(file *ast.SourceFile) { b := getBinder() defer putBinder(b) b.file = file - b.languageVersion = b.options().EmitScriptTarget b.inStrictMode = b.options().BindInStrictMode && !file.IsDeclarationFile || ast.IsExternalModule(file) b.unreachableFlow = b.newFlowNode(ast.FlowFlagsUnreachable) b.reportedUnreachableFlow = b.newFlowNode(ast.FlowFlagsUnreachable) @@ -1181,7 +1179,6 @@ func (b *Binder) bindParameter(node *ast.Node) { func (b *Binder) bindFunctionDeclaration(node *ast.Node) { b.checkStrictModeFunctionName(node) if b.inStrictMode { - b.checkStrictModeFunctionDeclaration(node) b.bindBlockScopedDeclaration(node, ast.SymbolFlagsFunction, ast.SymbolFlagsFunctionExcludes) } else { b.declareSymbolAndAddToSymbolTable(node, ast.SymbolFlagsFunction, ast.SymbolFlagsFunctionExcludes) @@ -1364,17 +1361,6 @@ func (b *Binder) checkStrictModeFunctionName(node *ast.Node) { } } -func (b *Binder) checkStrictModeFunctionDeclaration(node *ast.Node) { - if b.languageVersion < core.ScriptTargetES2015 { - // Report error if function is not top level function declaration - if b.blockScopeContainer.Kind != ast.KindSourceFile && b.blockScopeContainer.Kind != ast.KindModuleDeclaration && !ast.IsFunctionLikeOrClassStaticBlockDeclaration(b.blockScopeContainer) { - // We check first if the name is inside class declaration or class expression; if so give explicit message - // otherwise report generic error message. - b.errorOnNode(node, b.getStrictModeBlockScopeFunctionDeclarationMessage(node)) - } - } -} - func (b *Binder) getStrictModeBlockScopeFunctionDeclarationMessage(node *ast.Node) *diagnostics.Message { // Provide specialized messages to help the user understand why we think they're in strict mode. if ast.GetContainingClass(node) != nil { @@ -1443,7 +1429,7 @@ func (b *Binder) checkStrictModeWithStatement(node *ast.Node) { func (b *Binder) checkStrictModeLabeledStatement(node *ast.Node) { // Grammar checking for labeledStatement - if b.inStrictMode && b.options().EmitScriptTarget >= core.ScriptTargetES2015 { + if b.inStrictMode { data := node.AsLabeledStatement() if ast.IsDeclarationStatement(data.Statement) || ast.IsVariableStatement(data.Statement) { b.errorOnFirstToken(data.Label, diagnostics.A_label_is_not_allowed_here) diff --git a/internal/checker/jsx.go b/internal/checker/jsx.go index 4b38947726..5629ba9ff7 100644 --- a/internal/checker/jsx.go +++ b/internal/checker/jsx.go @@ -1422,7 +1422,7 @@ func (c *Checker) getJsxFragmentFactoryEntity(location *ast.Node) *ast.EntityNam } func (c *Checker) parseIsolatedEntityName(name string) *ast.Node { - result := parser.ParseIsolatedEntityName(name, c.languageVersion) + result := parser.ParseIsolatedEntityName(name) if result != nil { markAsSynthetic(result) } diff --git a/internal/core/compileroptions.go b/internal/core/compileroptions.go index 8b2db983c9..c63d00eab1 100644 --- a/internal/core/compileroptions.go +++ b/internal/core/compileroptions.go @@ -355,7 +355,6 @@ type SourceFileAffectingCompilerOptions struct { AllowUnreachableCode Tristate AllowUnusedLabels Tristate BindInStrictMode bool - EmitScriptTarget ScriptTarget ShouldPreserveConstEnums bool } @@ -365,7 +364,6 @@ func (options *CompilerOptions) SourceFileAffecting() SourceFileAffectingCompile AllowUnreachableCode: options.AllowUnreachableCode, AllowUnusedLabels: options.AllowUnusedLabels, BindInStrictMode: options.AlwaysStrict.IsTrue() || options.Strict.IsTrue(), - EmitScriptTarget: options.GetEmitScriptTarget(), ShouldPreserveConstEnums: options.ShouldPreserveConstEnums(), } }) diff --git a/internal/execute/tsc.go b/internal/execute/tsc.go index 3a6a4f31cf..5edfe9c4d8 100644 --- a/internal/execute/tsc.go +++ b/internal/execute/tsc.go @@ -74,11 +74,8 @@ func fmtMain(sys System, input, output string) ExitStatus { text := fileContent pathified := tspath.ToPath(input, sys.GetCurrentDirectory(), true) sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ - FileName: string(pathified), - Path: pathified, - CompilerOptions: core.SourceFileAffectingCompilerOptions{ - EmitScriptTarget: core.ScriptTargetLatest, - }, + FileName: string(pathified), + Path: pathified, JSDocParsingMode: ast.JSDocParsingModeParseAll, }, text, core.GetScriptKindFromFileName(string(pathified))) ast.SetParentInChildren(sourceFile.AsNode()) diff --git a/internal/format/api_test.go b/internal/format/api_test.go index 76e00e5113..62e87898a8 100644 --- a/internal/format/api_test.go +++ b/internal/format/api_test.go @@ -33,10 +33,6 @@ func applyBulkEdits(text string, edits []core.TextChange) string { return b.String() } -var parseCompilerOptions = core.SourceFileAffectingCompilerOptions{ - EmitScriptTarget: core.ScriptTargetLatest, -} - func TestFormat(t *testing.T) { t.Parallel() @@ -60,9 +56,8 @@ func TestFormat(t *testing.T) { assert.NilError(t, err) text := string(fileContent) sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ - FileName: "/checker.ts", - Path: "/checker.ts", - CompilerOptions: parseCompilerOptions, + FileName: "/checker.ts", + Path: "/checker.ts", }, text, core.ScriptKindTS) ast.SetParentInChildren(sourceFile.AsNode()) edits := format.FormatDocument(ctx, sourceFile) @@ -91,9 +86,8 @@ func BenchmarkFormat(b *testing.B) { assert.NilError(b, err) text := string(fileContent) sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ - FileName: "/checker.ts", - Path: "/checker.ts", - CompilerOptions: parseCompilerOptions, + FileName: "/checker.ts", + Path: "/checker.ts", }, text, core.ScriptKindTS) ast.SetParentInChildren(sourceFile.AsNode()) diff --git a/internal/parser/parser.go b/internal/parser/parser.go index 1952d6ffe8..fc1e70e19a 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -175,13 +175,10 @@ func (p *Parser) parseJSONText() *ast.SourceFile { return result } -func ParseIsolatedEntityName(text string, languageVersion core.ScriptTarget) *ast.EntityName { +func ParseIsolatedEntityName(text string) *ast.EntityName { p := getParser() defer putParser(p) p.initializeState(ast.SourceFileParseOptions{ - CompilerOptions: core.SourceFileAffectingCompilerOptions{ - EmitScriptTarget: languageVersion, - }, JSDocParsingMode: ast.JSDocParsingModeParseAll, }, text, core.ScriptKindJS) p.nextToken() @@ -213,7 +210,6 @@ func (p *Parser) initializeState(opts ast.SourceFileParseOptions, sourceText str } p.scanner.SetText(p.sourceText) p.scanner.SetOnError(p.scanError) - p.scanner.SetScriptTarget(p.opts.CompilerOptions.EmitScriptTarget) p.scanner.SetLanguageVariant(p.languageVariant) p.scanner.SetScriptKind(p.scriptKind) p.scanner.SetJSDocParsingMode(p.opts.JSDocParsingMode) diff --git a/internal/parser/parser_test.go b/internal/parser/parser_test.go index 11a01b0220..4cea055265 100644 --- a/internal/parser/parser_test.go +++ b/internal/parser/parser_test.go @@ -40,11 +40,8 @@ func BenchmarkParse(b *testing.B) { jsdocMode := jsdoc.mode opts := ast.SourceFileParseOptions{ - FileName: fileName, - Path: path, - CompilerOptions: core.SourceFileAffectingCompilerOptions{ - EmitScriptTarget: core.ScriptTargetESNext, - }, + FileName: fileName, + Path: path, JSDocParsingMode: jsdocMode, } @@ -138,11 +135,8 @@ func FuzzParser(f *testing.F) { path := tspath.Path(fileName) opts := ast.SourceFileParseOptions{ - FileName: fileName, - Path: path, - CompilerOptions: core.SourceFileAffectingCompilerOptions{ - EmitScriptTarget: scriptTarget, - }, + FileName: fileName, + Path: path, JSDocParsingMode: jsdocParsingMode, } diff --git a/internal/printer/printer.go b/internal/printer/printer.go index 9184bd3274..8d68f20015 100644 --- a/internal/printer/printer.go +++ b/internal/printer/printer.go @@ -844,10 +844,9 @@ func (p *Printer) shouldAllowTrailingComma(node *ast.Node, list *ast.NodeList) b return false } - target := p.currentSourceFile.LanguageVersion() switch node.Kind { case ast.KindObjectLiteralExpression: - return target >= core.ScriptTargetES5 + return true case ast.KindArrayLiteralExpression, ast.KindArrowFunction, ast.KindConstructor, @@ -874,11 +873,11 @@ func (p *Printer) shouldAllowTrailingComma(node *ast.Node, list *ast.NodeList) b case ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindMethodDeclaration: - return target >= core.ScriptTargetES2015 || list == node.FunctionLikeData().TypeParameters + return true case ast.KindCallExpression: - return target >= core.ScriptTargetES2015 || list == node.AsCallExpression().TypeArguments + return true case ast.KindNewExpression: - return target >= core.ScriptTargetES2015 || list == node.AsNewExpression().TypeArguments + return true } return false diff --git a/internal/scanner/scanner.go b/internal/scanner/scanner.go index 5ca20bacfa..967c44f10f 100644 --- a/internal/scanner/scanner.go +++ b/internal/scanner/scanner.go @@ -207,9 +207,7 @@ type ScannerState struct { } type Scanner struct { - text string - // TODO: remove this? unused except for (unimplemented) regex checking - languageVersion core.ScriptTarget + text string languageVariant core.LanguageVariant onError ErrorCallback skipTrivia bool @@ -222,7 +220,7 @@ func defaultScanner() Scanner { // Using a function rather than a global is intentional; this function is // inlined as pure code (zeroing + moves), whereas a global requires write // barriers since the memory is mutable. - return Scanner{languageVersion: core.ScriptTargetLatest, skipTrivia: true} + return Scanner{skipTrivia: true} } func NewScanner() *Scanner { @@ -339,10 +337,6 @@ func (s *Scanner) SetOnError(errorCallback ErrorCallback) { s.onError = errorCallback } -func (s *Scanner) SetScriptTarget(scriptTarget core.ScriptTarget) { - s.languageVersion = scriptTarget -} - func (s *Scanner) SetScriptKind(scriptKind core.ScriptKind) { s.scriptKind = scriptKind } @@ -2237,7 +2231,6 @@ func GetScannerForSourceFile(sourceFile *ast.SourceFile, pos int) *Scanner { s := NewScanner() s.text = sourceFile.Text() s.pos = pos - s.languageVersion = sourceFile.LanguageVersion() s.languageVariant = sourceFile.LanguageVariant s.Scan() return s diff --git a/internal/testutil/parsetestutil/parsetestutil.go b/internal/testutil/parsetestutil/parsetestutil.go index 73fbc556ce..2901f6b2b1 100644 --- a/internal/testutil/parsetestutil/parsetestutil.go +++ b/internal/testutil/parsetestutil/parsetestutil.go @@ -11,17 +11,12 @@ import ( "github.com/microsoft/typescript-go/internal/tspath" ) -var parseCompilerOptions = core.SourceFileAffectingCompilerOptions{ - EmitScriptTarget: core.ScriptTargetLatest, -} - // Simplifies parsing an input string into a SourceFile for testing purposes. func ParseTypeScript(text string, jsx bool) *ast.SourceFile { fileName := core.IfElse(jsx, "/main.tsx", "/main.ts") file := parser.ParseSourceFile(ast.SourceFileParseOptions{ FileName: fileName, Path: tspath.Path(fileName), - CompilerOptions: parseCompilerOptions, JSDocParsingMode: ast.JSDocParsingModeParseNone, }, text, core.GetScriptKindFromFileName(fileName)) ast.SetParentInChildren(file.AsNode()) diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictClass.errors.txt b/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictClass.errors.txt index f0e4c2cc06..0fcc185589 100644 --- a/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictClass.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictClass.errors.txt @@ -1,14 +1,11 @@ -blockScopedFunctionDeclarationInStrictClass.ts(4,22): error TS1251: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. Class definitions are automatically in strict mode. blockScopedFunctionDeclarationInStrictClass.ts(7,9): error TS2304: Cannot find name 'foo'. -==== blockScopedFunctionDeclarationInStrictClass.ts (2 errors) ==== +==== blockScopedFunctionDeclarationInStrictClass.ts (1 errors) ==== class c { method() { if (true) { function foo() { } - ~~~ -!!! error TS1251: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. Class definitions are automatically in strict mode. foo(); // ok } foo(); // not ok diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictClass.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictClass.errors.txt.diff new file mode 100644 index 0000000000..a92cdeb5e1 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictClass.errors.txt.diff @@ -0,0 +1,18 @@ +--- old.blockScopedFunctionDeclarationInStrictClass.errors.txt ++++ new.blockScopedFunctionDeclarationInStrictClass.errors.txt +@@= skipped -0, +0 lines =@@ +-blockScopedFunctionDeclarationInStrictClass.ts(4,22): error TS1251: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. Class definitions are automatically in strict mode. + blockScopedFunctionDeclarationInStrictClass.ts(7,9): error TS2304: Cannot find name 'foo'. + + +-==== blockScopedFunctionDeclarationInStrictClass.ts (2 errors) ==== ++==== blockScopedFunctionDeclarationInStrictClass.ts (1 errors) ==== + class c { + method() { + if (true) { + function foo() { } +- ~~~ +-!!! error TS1251: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. Class definitions are automatically in strict mode. + foo(); // ok + } + foo(); // not ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictModule.errors.txt b/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictModule.errors.txt index 175fd5671a..f958ba0e05 100644 --- a/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictModule.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictModule.errors.txt @@ -1,12 +1,9 @@ -blockScopedFunctionDeclarationInStrictModule.ts(2,14): error TS1252: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. Modules are automatically in strict mode. blockScopedFunctionDeclarationInStrictModule.ts(6,10): error TS2304: Cannot find name 'foo'. -==== blockScopedFunctionDeclarationInStrictModule.ts (2 errors) ==== +==== blockScopedFunctionDeclarationInStrictModule.ts (1 errors) ==== if (true) { function foo() { } - ~~~ -!!! error TS1252: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. Modules are automatically in strict mode. foo(); // ok } diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationStrictES5.errors.txt b/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationStrictES5.errors.txt index 857941c464..120e1f45d5 100644 --- a/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationStrictES5.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationStrictES5.errors.txt @@ -1,13 +1,10 @@ -blockScopedFunctionDeclarationStrictES5.ts(3,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. blockScopedFunctionDeclarationStrictES5.ts(6,1): error TS2304: Cannot find name 'foo'. -==== blockScopedFunctionDeclarationStrictES5.ts (2 errors) ==== +==== blockScopedFunctionDeclarationStrictES5.ts (1 errors) ==== "use strict"; if (true) { function foo() { } // Error to declare function in block scope - ~~~ -!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. foo(); // This call should be ok } foo(); // Error to find name foo diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationStrictES5.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationStrictES5.errors.txt.diff new file mode 100644 index 0000000000..9c8c1bcd6c --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationStrictES5.errors.txt.diff @@ -0,0 +1,17 @@ +--- old.blockScopedFunctionDeclarationStrictES5.errors.txt ++++ new.blockScopedFunctionDeclarationStrictES5.errors.txt +@@= skipped -0, +0 lines =@@ +-blockScopedFunctionDeclarationStrictES5.ts(3,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. + blockScopedFunctionDeclarationStrictES5.ts(6,1): error TS2304: Cannot find name 'foo'. + + +-==== blockScopedFunctionDeclarationStrictES5.ts (2 errors) ==== ++==== blockScopedFunctionDeclarationStrictES5.ts (1 errors) ==== + "use strict"; + if (true) { + function foo() { } // Error to declare function in block scope +- ~~~ +-!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. + foo(); // This call should be ok + } + foo(); // Error to find name foo \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt b/testdata/baselines/reference/submodule/compiler/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt index 2a0872026d..2d70db4f6c 100644 --- a/testdata/baselines/reference/submodule/compiler/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt @@ -1,18 +1,14 @@ -blockScopedSameNameFunctionDeclarationStrictES5.ts(4,18): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. blockScopedSameNameFunctionDeclarationStrictES5.ts(6,13): error TS2554: Expected 0 arguments, but got 1. -blockScopedSameNameFunctionDeclarationStrictES5.ts(9,18): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. blockScopedSameNameFunctionDeclarationStrictES5.ts(11,13): error TS2554: Expected 0 arguments, but got 1. blockScopedSameNameFunctionDeclarationStrictES5.ts(14,5): error TS2554: Expected 1 arguments, but got 0. blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): error TS2554: Expected 1 arguments, but got 0. -==== blockScopedSameNameFunctionDeclarationStrictES5.ts (6 errors) ==== +==== blockScopedSameNameFunctionDeclarationStrictES5.ts (4 errors) ==== "use strict"; function foo(a: number) { if (a === 1) { function foo() { } // Error to declare function in block scope - ~~~ -!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. foo(); foo(10); // not ok ~~ @@ -20,8 +16,6 @@ blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): error TS2554: Expected } else { function foo() { } // Error to declare function in block scope - ~~~ -!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. foo(); foo(10); // not ok ~~ diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt.diff new file mode 100644 index 0000000000..dcc648a56c --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt.diff @@ -0,0 +1,31 @@ +--- old.blockScopedSameNameFunctionDeclarationStrictES5.errors.txt ++++ new.blockScopedSameNameFunctionDeclarationStrictES5.errors.txt +@@= skipped -0, +0 lines =@@ +-blockScopedSameNameFunctionDeclarationStrictES5.ts(4,18): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. + blockScopedSameNameFunctionDeclarationStrictES5.ts(6,13): error TS2554: Expected 0 arguments, but got 1. +-blockScopedSameNameFunctionDeclarationStrictES5.ts(9,18): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. + blockScopedSameNameFunctionDeclarationStrictES5.ts(11,13): error TS2554: Expected 0 arguments, but got 1. + blockScopedSameNameFunctionDeclarationStrictES5.ts(14,5): error TS2554: Expected 1 arguments, but got 0. + blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): error TS2554: Expected 1 arguments, but got 0. + + +-==== blockScopedSameNameFunctionDeclarationStrictES5.ts (6 errors) ==== ++==== blockScopedSameNameFunctionDeclarationStrictES5.ts (4 errors) ==== + "use strict"; + function foo(a: number) { + if (a === 1) { + function foo() { } // Error to declare function in block scope +- ~~~ +-!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. + foo(); + foo(10); // not ok + ~~ +@@= skipped -19, +15 lines =@@ + } + else { + function foo() { } // Error to declare function in block scope +- ~~~ +-!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. + foo(); + foo(10); // not ok + ~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/downlevelLetConst18.errors.txt b/testdata/baselines/reference/submodule/compiler/downlevelLetConst18.errors.txt deleted file mode 100644 index 1b818a010b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/downlevelLetConst18.errors.txt +++ /dev/null @@ -1,39 +0,0 @@ -downlevelLetConst18.ts(4,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. -downlevelLetConst18.ts(8,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. - - -==== downlevelLetConst18.ts (2 errors) ==== - 'use strict' - - for (let x; ;) { - function foo() { x }; - ~~~ -!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. - } - - for (let x; ;) { - function foo1() { x }; - ~~~~ -!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. - } - - for (let x; ;) { - (() => { x })(); - } - - for (const x = 1; ;) { - (() => { x })(); - } - - for (let x; ;) { - ({ foo() { x }}) - } - - for (let x; ;) { - ({ get foo() { return x } }) - } - - for (let x; ;) { - ({ set foo(v) { x } }) - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/downlevelLetConst18.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/downlevelLetConst18.errors.txt.diff new file mode 100644 index 0000000000..53cd185a95 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/downlevelLetConst18.errors.txt.diff @@ -0,0 +1,43 @@ +--- old.downlevelLetConst18.errors.txt ++++ new.downlevelLetConst18.errors.txt +@@= skipped -0, +0 lines =@@ +-downlevelLetConst18.ts(4,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. +-downlevelLetConst18.ts(8,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. +- +- +-==== downlevelLetConst18.ts (2 errors) ==== +- 'use strict' +- +- for (let x; ;) { +- function foo() { x }; +- ~~~ +-!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. +- } +- +- for (let x; ;) { +- function foo1() { x }; +- ~~~~ +-!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. +- } +- +- for (let x; ;) { +- (() => { x })(); +- } +- +- for (const x = 1; ;) { +- (() => { x })(); +- } +- +- for (let x; ;) { +- ({ foo() { x }}) +- } +- +- for (let x; ;) { +- ({ get foo() { return x } }) +- } +- +- for (let x; ;) { +- ({ set foo(v) { x } }) +- } +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/downlevelLetConst19.errors.txt b/testdata/baselines/reference/submodule/compiler/downlevelLetConst19.errors.txt deleted file mode 100644 index 216ba2d6de..0000000000 --- a/testdata/baselines/reference/submodule/compiler/downlevelLetConst19.errors.txt +++ /dev/null @@ -1,25 +0,0 @@ -downlevelLetConst19.ts(9,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. - - -==== downlevelLetConst19.ts (1 errors) ==== - 'use strict' - declare function use(a: any); - var x; - function a() { - { - let x; - use(x); - - function b() { - ~ -!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. - { - let x; - use(x); - } - use(x); - } - } - use(x) - } - use(x) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/downlevelLetConst19.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/downlevelLetConst19.errors.txt.diff new file mode 100644 index 0000000000..fb3eb9ab2a --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/downlevelLetConst19.errors.txt.diff @@ -0,0 +1,29 @@ +--- old.downlevelLetConst19.errors.txt ++++ new.downlevelLetConst19.errors.txt +@@= skipped -0, +0 lines =@@ +-downlevelLetConst19.ts(9,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. +- +- +-==== downlevelLetConst19.ts (1 errors) ==== +- 'use strict' +- declare function use(a: any); +- var x; +- function a() { +- { +- let x; +- use(x); +- +- function b() { +- ~ +-!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. +- { +- let x; +- use(x); +- } +- use(x); +- } +- } +- use(x) +- } +- use(x) ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash1.errors.txt b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash1.errors.txt index 35cdc3ccea..7ea8c06f82 100644 --- a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash1.errors.txt @@ -1,10 +1,13 @@ +labeledStatementDeclarationListInLoopNoCrash1.ts(3,3): error TS1344: 'A label is not allowed here. labeledStatementDeclarationListInLoopNoCrash1.ts(3,11): error TS1123: Variable declaration list cannot be empty. -==== labeledStatementDeclarationListInLoopNoCrash1.ts (1 errors) ==== +==== labeledStatementDeclarationListInLoopNoCrash1.ts (2 errors) ==== for (let x of []) { var v0 = x; foo: var; + ~~~ +!!! error TS1344: 'A label is not allowed here. !!! error TS1123: Variable declaration list cannot be empty. (function() { return x + v0}); diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash1.errors.txt.diff new file mode 100644 index 0000000000..fcf3f5b4bb --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash1.errors.txt.diff @@ -0,0 +1,17 @@ +--- old.labeledStatementDeclarationListInLoopNoCrash1.errors.txt ++++ new.labeledStatementDeclarationListInLoopNoCrash1.errors.txt +@@= skipped -0, +0 lines =@@ ++labeledStatementDeclarationListInLoopNoCrash1.ts(3,3): error TS1344: 'A label is not allowed here. + labeledStatementDeclarationListInLoopNoCrash1.ts(3,11): error TS1123: Variable declaration list cannot be empty. + + +-==== labeledStatementDeclarationListInLoopNoCrash1.ts (1 errors) ==== ++==== labeledStatementDeclarationListInLoopNoCrash1.ts (2 errors) ==== + for (let x of []) { + var v0 = x; + foo: var; ++ ~~~ ++!!! error TS1344: 'A label is not allowed here. + + !!! error TS1123: Variable declaration list cannot be empty. + (function() { return x + v0}); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash2.errors.txt b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash2.errors.txt new file mode 100644 index 0000000000..cccda1a9a3 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash2.errors.txt @@ -0,0 +1,12 @@ +labeledStatementDeclarationListInLoopNoCrash2.ts(3,3): error TS1344: 'A label is not allowed here. + + +==== labeledStatementDeclarationListInLoopNoCrash2.ts (1 errors) ==== + for (let x of []) { + var v0 = x; + foo: var y; + ~~~ +!!! error TS1344: 'A label is not allowed here. + (function() { return x + v0}); + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash2.errors.txt.diff new file mode 100644 index 0000000000..cb6d70099f --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash2.errors.txt.diff @@ -0,0 +1,16 @@ +--- old.labeledStatementDeclarationListInLoopNoCrash2.errors.txt ++++ new.labeledStatementDeclarationListInLoopNoCrash2.errors.txt +@@= skipped -0, +0 lines =@@ +- ++labeledStatementDeclarationListInLoopNoCrash2.ts(3,3): error TS1344: 'A label is not allowed here. ++ ++ ++==== labeledStatementDeclarationListInLoopNoCrash2.ts (1 errors) ==== ++ for (let x of []) { ++ var v0 = x; ++ foo: var y; ++ ~~~ ++!!! error TS1344: 'A label is not allowed here. ++ (function() { return x + v0}); ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.errors.txt b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.errors.txt index 075f135a3b..7580e978e9 100644 --- a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.errors.txt @@ -9,6 +9,7 @@ labeledStatementDeclarationListInLoopNoCrash3.ts(15,42): error TS1005: ')' expec labeledStatementDeclarationListInLoopNoCrash3.ts(15,53): error TS2304: Cannot find name 'fontSize'. labeledStatementDeclarationListInLoopNoCrash3.ts(15,61): error TS1005: ';' expected. labeledStatementDeclarationListInLoopNoCrash3.ts(16,12): error TS1005: ';' expected. +labeledStatementDeclarationListInLoopNoCrash3.ts(16,12): error TS1344: 'A label is not allowed here. labeledStatementDeclarationListInLoopNoCrash3.ts(16,23): error TS1134: Variable declaration expected. labeledStatementDeclarationListInLoopNoCrash3.ts(16,38): error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`. labeledStatementDeclarationListInLoopNoCrash3.ts(16,39): error TS1005: ')' expected. @@ -17,7 +18,7 @@ labeledStatementDeclarationListInLoopNoCrash3.ts(16,56): error TS1005: ';' expec labeledStatementDeclarationListInLoopNoCrash3.ts(22,1): error TS1160: Unterminated template literal. -==== labeledStatementDeclarationListInLoopNoCrash3.ts (17 errors) ==== +==== labeledStatementDeclarationListInLoopNoCrash3.ts (18 errors) ==== // https://github.com/microsoft/TypeScript/issues/59345 export class ParseThemeData { @@ -56,6 +57,8 @@ labeledStatementDeclarationListInLoopNoCrash3.ts(22,1): error TS1160: Unterminat `height: var(--button-size-${fontType}-height)`, ~~~~~~ !!! error TS1005: ';' expected. + ~~~~~~ +!!! error TS1344: 'A label is not allowed here. ~ !!! error TS1134: Variable declaration expected. ~ diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.errors.txt.diff new file mode 100644 index 0000000000..7647917a93 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.errors.txt.diff @@ -0,0 +1,28 @@ +--- old.labeledStatementDeclarationListInLoopNoCrash3.errors.txt ++++ new.labeledStatementDeclarationListInLoopNoCrash3.errors.txt +@@= skipped -8, +8 lines =@@ + labeledStatementDeclarationListInLoopNoCrash3.ts(15,53): error TS2304: Cannot find name 'fontSize'. + labeledStatementDeclarationListInLoopNoCrash3.ts(15,61): error TS1005: ';' expected. + labeledStatementDeclarationListInLoopNoCrash3.ts(16,12): error TS1005: ';' expected. ++labeledStatementDeclarationListInLoopNoCrash3.ts(16,12): error TS1344: 'A label is not allowed here. + labeledStatementDeclarationListInLoopNoCrash3.ts(16,23): error TS1134: Variable declaration expected. + labeledStatementDeclarationListInLoopNoCrash3.ts(16,38): error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`. + labeledStatementDeclarationListInLoopNoCrash3.ts(16,39): error TS1005: ')' expected. +@@= skipped -8, +9 lines =@@ + labeledStatementDeclarationListInLoopNoCrash3.ts(22,1): error TS1160: Unterminated template literal. + + +-==== labeledStatementDeclarationListInLoopNoCrash3.ts (17 errors) ==== ++==== labeledStatementDeclarationListInLoopNoCrash3.ts (18 errors) ==== + // https://github.com/microsoft/TypeScript/issues/59345 + + export class ParseThemeData { +@@= skipped -39, +39 lines =@@ + `height: var(--button-size-${fontType}-height)`, + ~~~~~~ + !!! error TS1005: ';' expected. ++ ~~~~~~ ++!!! error TS1344: 'A label is not allowed here. + ~ + !!! error TS1134: Variable declaration expected. + ~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash4.errors.txt b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash4.errors.txt index 8d20a6b2ac..4b7f3b90aa 100644 --- a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash4.errors.txt @@ -9,12 +9,13 @@ labeledStatementDeclarationListInLoopNoCrash4.ts(13,42): error TS1005: ')' expec labeledStatementDeclarationListInLoopNoCrash4.ts(13,53): error TS2304: Cannot find name 'fontSize'. labeledStatementDeclarationListInLoopNoCrash4.ts(13,61): error TS1005: ';' expected. labeledStatementDeclarationListInLoopNoCrash4.ts(14,12): error TS1005: ';' expected. +labeledStatementDeclarationListInLoopNoCrash4.ts(14,12): error TS1344: 'A label is not allowed here. labeledStatementDeclarationListInLoopNoCrash4.ts(14,27): error TS1005: ',' expected. labeledStatementDeclarationListInLoopNoCrash4.ts(20,1): error TS1005: '}' expected. labeledStatementDeclarationListInLoopNoCrash4.ts(20,1): error TS1160: Unterminated template literal. -==== labeledStatementDeclarationListInLoopNoCrash4.ts (14 errors) ==== +==== labeledStatementDeclarationListInLoopNoCrash4.ts (15 errors) ==== export class ParseThemeData { parseButton(button: any) { const {type, size} = button; @@ -51,6 +52,8 @@ labeledStatementDeclarationListInLoopNoCrash4.ts(20,1): error TS1160: Unterminat `height: var foo`, ~~~~~~ !!! error TS1005: ';' expected. + ~~~~~~ +!!! error TS1344: 'A label is not allowed here. ~~ ].join(';') ~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash4.errors.txt.diff new file mode 100644 index 0000000000..fccb13ed23 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash4.errors.txt.diff @@ -0,0 +1,26 @@ +--- old.labeledStatementDeclarationListInLoopNoCrash4.errors.txt ++++ new.labeledStatementDeclarationListInLoopNoCrash4.errors.txt +@@= skipped -8, +8 lines =@@ + labeledStatementDeclarationListInLoopNoCrash4.ts(13,53): error TS2304: Cannot find name 'fontSize'. + labeledStatementDeclarationListInLoopNoCrash4.ts(13,61): error TS1005: ';' expected. + labeledStatementDeclarationListInLoopNoCrash4.ts(14,12): error TS1005: ';' expected. ++labeledStatementDeclarationListInLoopNoCrash4.ts(14,12): error TS1344: 'A label is not allowed here. + labeledStatementDeclarationListInLoopNoCrash4.ts(14,27): error TS1005: ',' expected. + labeledStatementDeclarationListInLoopNoCrash4.ts(20,1): error TS1005: '}' expected. + labeledStatementDeclarationListInLoopNoCrash4.ts(20,1): error TS1160: Unterminated template literal. + + +-==== labeledStatementDeclarationListInLoopNoCrash4.ts (14 errors) ==== ++==== labeledStatementDeclarationListInLoopNoCrash4.ts (15 errors) ==== + export class ParseThemeData { + parseButton(button: any) { + const {type, size} = button; +@@= skipped -42, +43 lines =@@ + `height: var foo`, + ~~~~~~ + !!! error TS1005: ';' expected. ++ ~~~~~~ ++!!! error TS1344: 'A label is not allowed here. + ~~ + ].join(';') + ~~~~~~~~~~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).errors.txt b/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).errors.txt index c82821c21e..89400ea7ad 100644 --- a/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).errors.txt @@ -1,15 +1,18 @@ labeledStatementExportDeclarationNoCrash1.ts(3,14): error TS1155: 'const' declarations must be initialized. +labeledStatementExportDeclarationNoCrash1.ts(4,1): error TS1344: 'A label is not allowed here. labeledStatementExportDeclarationNoCrash1.ts(5,1): error TS1184: Modifiers cannot appear here. labeledStatementExportDeclarationNoCrash1.ts(5,14): error TS1155: 'const' declarations must be initialized. -==== labeledStatementExportDeclarationNoCrash1.ts (3 errors) ==== +==== labeledStatementExportDeclarationNoCrash1.ts (4 errors) ==== // https://github.com/microsoft/TypeScript/issues/59372 export const box: string ~~~ !!! error TS1155: 'const' declarations must be initialized. subTitle: + ~~~~~~~~ +!!! error TS1344: 'A label is not allowed here. export const title: string ~~~~~~ !!! error TS1184: Modifiers cannot appear here. diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).errors.txt.diff new file mode 100644 index 0000000000..a410ffbd35 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).errors.txt.diff @@ -0,0 +1,22 @@ +--- old.labeledStatementExportDeclarationNoCrash1(module=commonjs).errors.txt ++++ new.labeledStatementExportDeclarationNoCrash1(module=commonjs).errors.txt +@@= skipped -0, +0 lines =@@ + labeledStatementExportDeclarationNoCrash1.ts(3,14): error TS1155: 'const' declarations must be initialized. ++labeledStatementExportDeclarationNoCrash1.ts(4,1): error TS1344: 'A label is not allowed here. + labeledStatementExportDeclarationNoCrash1.ts(5,1): error TS1184: Modifiers cannot appear here. + labeledStatementExportDeclarationNoCrash1.ts(5,14): error TS1155: 'const' declarations must be initialized. + + +-==== labeledStatementExportDeclarationNoCrash1.ts (3 errors) ==== ++==== labeledStatementExportDeclarationNoCrash1.ts (4 errors) ==== + // https://github.com/microsoft/TypeScript/issues/59372 + + export const box: string + ~~~ + !!! error TS1155: 'const' declarations must be initialized. + subTitle: ++ ~~~~~~~~ ++!!! error TS1344: 'A label is not allowed here. + export const title: string + ~~~~~~ + !!! error TS1184: Modifiers cannot appear here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=esnext).errors.txt b/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=esnext).errors.txt index c82821c21e..89400ea7ad 100644 --- a/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=esnext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=esnext).errors.txt @@ -1,15 +1,18 @@ labeledStatementExportDeclarationNoCrash1.ts(3,14): error TS1155: 'const' declarations must be initialized. +labeledStatementExportDeclarationNoCrash1.ts(4,1): error TS1344: 'A label is not allowed here. labeledStatementExportDeclarationNoCrash1.ts(5,1): error TS1184: Modifiers cannot appear here. labeledStatementExportDeclarationNoCrash1.ts(5,14): error TS1155: 'const' declarations must be initialized. -==== labeledStatementExportDeclarationNoCrash1.ts (3 errors) ==== +==== labeledStatementExportDeclarationNoCrash1.ts (4 errors) ==== // https://github.com/microsoft/TypeScript/issues/59372 export const box: string ~~~ !!! error TS1155: 'const' declarations must be initialized. subTitle: + ~~~~~~~~ +!!! error TS1344: 'A label is not allowed here. export const title: string ~~~~~~ !!! error TS1184: Modifiers cannot appear here. diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=esnext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=esnext).errors.txt.diff new file mode 100644 index 0000000000..1f3407576e --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=esnext).errors.txt.diff @@ -0,0 +1,22 @@ +--- old.labeledStatementExportDeclarationNoCrash1(module=esnext).errors.txt ++++ new.labeledStatementExportDeclarationNoCrash1(module=esnext).errors.txt +@@= skipped -0, +0 lines =@@ + labeledStatementExportDeclarationNoCrash1.ts(3,14): error TS1155: 'const' declarations must be initialized. ++labeledStatementExportDeclarationNoCrash1.ts(4,1): error TS1344: 'A label is not allowed here. + labeledStatementExportDeclarationNoCrash1.ts(5,1): error TS1184: Modifiers cannot appear here. + labeledStatementExportDeclarationNoCrash1.ts(5,14): error TS1155: 'const' declarations must be initialized. + + +-==== labeledStatementExportDeclarationNoCrash1.ts (3 errors) ==== ++==== labeledStatementExportDeclarationNoCrash1.ts (4 errors) ==== + // https://github.com/microsoft/TypeScript/issues/59372 + + export const box: string + ~~~ + !!! error TS1155: 'const' declarations must be initialized. + subTitle: ++ ~~~~~~~~ ++!!! error TS1344: 'A label is not allowed here. + export const title: string + ~~~~~~ + !!! error TS1184: Modifiers cannot appear here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=system).errors.txt b/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=system).errors.txt index c82821c21e..89400ea7ad 100644 --- a/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=system).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=system).errors.txt @@ -1,15 +1,18 @@ labeledStatementExportDeclarationNoCrash1.ts(3,14): error TS1155: 'const' declarations must be initialized. +labeledStatementExportDeclarationNoCrash1.ts(4,1): error TS1344: 'A label is not allowed here. labeledStatementExportDeclarationNoCrash1.ts(5,1): error TS1184: Modifiers cannot appear here. labeledStatementExportDeclarationNoCrash1.ts(5,14): error TS1155: 'const' declarations must be initialized. -==== labeledStatementExportDeclarationNoCrash1.ts (3 errors) ==== +==== labeledStatementExportDeclarationNoCrash1.ts (4 errors) ==== // https://github.com/microsoft/TypeScript/issues/59372 export const box: string ~~~ !!! error TS1155: 'const' declarations must be initialized. subTitle: + ~~~~~~~~ +!!! error TS1344: 'A label is not allowed here. export const title: string ~~~~~~ !!! error TS1184: Modifiers cannot appear here. diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/blockScopedFunctionDeclarationInStrictModule.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/blockScopedFunctionDeclarationInStrictModule.errors.txt.diff new file mode 100644 index 0000000000..6373016809 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/blockScopedFunctionDeclarationInStrictModule.errors.txt.diff @@ -0,0 +1,16 @@ +--- old.blockScopedFunctionDeclarationInStrictModule.errors.txt ++++ new.blockScopedFunctionDeclarationInStrictModule.errors.txt +@@= skipped -0, +0 lines =@@ +-blockScopedFunctionDeclarationInStrictModule.ts(2,14): error TS1252: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. Modules are automatically in strict mode. + blockScopedFunctionDeclarationInStrictModule.ts(6,10): error TS2304: Cannot find name 'foo'. + + +-==== blockScopedFunctionDeclarationInStrictModule.ts (2 errors) ==== ++==== blockScopedFunctionDeclarationInStrictModule.ts (1 errors) ==== + if (true) { + function foo() { } +- ~~~ +-!!! error TS1252: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. Modules are automatically in strict mode. + foo(); // ok + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/labeledStatementExportDeclarationNoCrash1(module=system).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/labeledStatementExportDeclarationNoCrash1(module=system).errors.txt.diff new file mode 100644 index 0000000000..5c22fe8e35 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/labeledStatementExportDeclarationNoCrash1(module=system).errors.txt.diff @@ -0,0 +1,22 @@ +--- old.labeledStatementExportDeclarationNoCrash1(module=system).errors.txt ++++ new.labeledStatementExportDeclarationNoCrash1(module=system).errors.txt +@@= skipped -0, +0 lines =@@ + labeledStatementExportDeclarationNoCrash1.ts(3,14): error TS1155: 'const' declarations must be initialized. ++labeledStatementExportDeclarationNoCrash1.ts(4,1): error TS1344: 'A label is not allowed here. + labeledStatementExportDeclarationNoCrash1.ts(5,1): error TS1184: Modifiers cannot appear here. + labeledStatementExportDeclarationNoCrash1.ts(5,14): error TS1155: 'const' declarations must be initialized. + + +-==== labeledStatementExportDeclarationNoCrash1.ts (3 errors) ==== ++==== labeledStatementExportDeclarationNoCrash1.ts (4 errors) ==== + // https://github.com/microsoft/TypeScript/issues/59372 + + export const box: string + ~~~ + !!! error TS1155: 'const' declarations must be initialized. + subTitle: ++ ~~~~~~~~ ++!!! error TS1344: 'A label is not allowed here. + export const title: string + ~~~~~~ + !!! error TS1184: Modifiers cannot appear here. \ No newline at end of file