From c89a80736e9d7e1ef7633f493a761414237f60ab Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 27 Dec 2018 19:46:21 +0900 Subject: [PATCH 1/7] add ES2019 target --- src/compiler/binder.ts | 2 +- src/compiler/commandLineParser.ts | 3 +- src/compiler/diagnosticMessages.json | 2 +- src/compiler/transformer.ts | 4 ++ src/compiler/transformers/es2019.ts | 37 ++++++++++++++ src/compiler/transformers/esnext.ts | 13 ----- src/compiler/tsconfig.json | 1 + src/compiler/types.ts | 51 ++++++++++--------- src/compiler/utilities.ts | 1 + .../unittests/config/commandLineParsing.ts | 2 +- .../config/convertCompilerOptionsFromJson.ts | 2 +- .../reference/api/tsserverlibrary.d.ts | 5 +- tests/baselines/reference/api/typescript.d.ts | 5 +- ...xt.js => emitter.noCatchBinding.es2019.js} | 7 +-- .../emitter.noCatchBinding.es2019.symbols | 11 ++++ ...es => emitter.noCatchBinding.es2019.types} | 3 +- .../emitter.noCatchBinding.esnext.symbols | 10 ---- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../emitter.noCatchBinding.es2019.ts} | 4 +- 27 files changed, 110 insertions(+), 71 deletions(-) create mode 100644 src/compiler/transformers/es2019.ts rename tests/baselines/reference/{emitter.noCatchBinding.esnext.js => emitter.noCatchBinding.es2019.js} (73%) create mode 100644 tests/baselines/reference/emitter.noCatchBinding.es2019.symbols rename tests/baselines/reference/{emitter.noCatchBinding.esnext.types => emitter.noCatchBinding.es2019.types} (57%) delete mode 100644 tests/baselines/reference/emitter.noCatchBinding.esnext.symbols rename tests/cases/conformance/emitter/{esnext/noCatchBinding/emitter.noCatchBinding.esnext.ts => es2019/noCatchBinding/emitter.noCatchBinding.es2019.ts} (85%) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 7216af4e817..79fef8b4e61 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -3259,7 +3259,7 @@ namespace ts { let transformFlags = subtreeFlags; if (!node.variableDeclaration) { - transformFlags |= TransformFlags.AssertESNext; + transformFlags |= TransformFlags.AssertES2019; } else if (isBindingPattern(node.variableDeclaration.name)) { transformFlags |= TransformFlags.AssertES2015; diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 43275605e23..053e09d48db 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -197,6 +197,7 @@ namespace ts { es2016: ScriptTarget.ES2016, es2017: ScriptTarget.ES2017, es2018: ScriptTarget.ES2018, + es2019: ScriptTarget.ES2019, esnext: ScriptTarget.ESNext, }), affectsSourceFile: true, @@ -204,7 +205,7 @@ namespace ts { paramType: Diagnostics.VERSION, showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, - description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_ES2018_or_ESNEXT, + description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_ES2018_ES2019_or_ESNEXT, }, { name: "module", diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index b0dfb85ce6d..ee2d3532e50 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3065,7 +3065,7 @@ "category": "Message", "code": 6014 }, - "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'.": { + "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'.": { "category": "Message", "code": 6015 }, diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index fdcaadb4040..0d04b5667a9 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -42,6 +42,10 @@ namespace ts { transformers.push(transformESNext); } + if (languageVersion < ScriptTarget.ES2019) { + transformers.push(transformES2019); + } + if (languageVersion < ScriptTarget.ES2017) { transformers.push(transformES2017); } diff --git a/src/compiler/transformers/es2019.ts b/src/compiler/transformers/es2019.ts new file mode 100644 index 00000000000..7dfd17481eb --- /dev/null +++ b/src/compiler/transformers/es2019.ts @@ -0,0 +1,37 @@ +/*@internal*/ +namespace ts { + export function transformES2019(context: TransformationContext) { + return chainBundle(transformSourceFile); + + function transformSourceFile(node: SourceFile) { + if (node.isDeclarationFile) { + return node; + } + + return visitEachChild(node, visitor, context); + } + + function visitor(node: Node): VisitResult { + if ((node.transformFlags & TransformFlags.ContainsES2019) === 0) { + return node; + } + switch (node.kind) { + case SyntaxKind.CatchClause: + return visitCatchClause(node as CatchClause); + default: + return visitEachChild(node, visitor, context); + } + } + + function visitCatchClause(node: CatchClause): CatchClause { + if (!node.variableDeclaration) { + return updateCatchClause( + node, + createVariableDeclaration(createTempVariable(/*recordTempVariable*/ undefined)), + visitNode(node.block, visitor, isBlock) + ); + } + return visitEachChild(node, visitor, context); + } + } +} diff --git a/src/compiler/transformers/esnext.ts b/src/compiler/transformers/esnext.ts index cd62cca2c9d..a19396ec63c 100644 --- a/src/compiler/transformers/esnext.ts +++ b/src/compiler/transformers/esnext.ts @@ -105,8 +105,6 @@ namespace ts { return visitExpressionStatement(node as ExpressionStatement); case SyntaxKind.ParenthesizedExpression: return visitParenthesizedExpression(node as ParenthesizedExpression, noDestructuringValue); - case SyntaxKind.CatchClause: - return visitCatchClause(node as CatchClause); case SyntaxKind.PropertyAccessExpression: if (capturedSuperProperties && isPropertyAccessExpression(node) && node.expression.kind === SyntaxKind.SuperKeyword) { capturedSuperProperties.set(node.name.escapedText, true); @@ -249,17 +247,6 @@ namespace ts { return visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context); } - function visitCatchClause(node: CatchClause): CatchClause { - if (!node.variableDeclaration) { - return updateCatchClause( - node, - createVariableDeclaration(createTempVariable(/*recordTempVariable*/ undefined)), - visitNode(node.block, visitor, isBlock) - ); - } - return visitEachChild(node, visitor, context); - } - /** * Visits a BinaryExpression that contains a destructuring assignment. * diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index c41f47f3c4a..e5f6e9f83ba 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -30,6 +30,7 @@ "transformers/destructuring.ts", "transformers/ts.ts", "transformers/es2017.ts", + "transformers/es2019.ts", "transformers/esnext.ts", "transformers/jsx.ts", "transformers/es2016.ts", diff --git a/src/compiler/types.ts b/src/compiler/types.ts index b70b4e4d3d0..a4285cfd775 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4646,7 +4646,8 @@ namespace ts { ES2016 = 3, ES2017 = 4, ES2018 = 5, - ESNext = 6, + ES2019 = 6, + ESNext = 7, JSON = 100, Latest = ESNext, } @@ -5034,32 +5035,33 @@ namespace ts { ContainsTypeScript = 1 << 1, ContainsJsx = 1 << 2, ContainsESNext = 1 << 3, - ContainsES2017 = 1 << 4, - ContainsES2016 = 1 << 5, - ES2015 = 1 << 6, - ContainsES2015 = 1 << 7, - Generator = 1 << 8, - ContainsGenerator = 1 << 9, - DestructuringAssignment = 1 << 10, - ContainsDestructuringAssignment = 1 << 11, + ContainsES2019 = 1 << 4, + ContainsES2017 = 1 << 5, + ContainsES2016 = 1 << 6, + ES2015 = 1 << 7, + ContainsES2015 = 1 << 8, + Generator = 1 << 9, + ContainsGenerator = 1 << 10, + DestructuringAssignment = 1 << 11, + ContainsDestructuringAssignment = 1 << 12, // Markers // - Flags used to indicate that a subtree contains a specific transformation. - ContainsTypeScriptClassSyntax = 1 << 12, // Decorators, Property Initializers, Parameter Property Initializers - ContainsLexicalThis = 1 << 13, - ContainsCapturedLexicalThis = 1 << 14, - ContainsLexicalThisInComputedPropertyName = 1 << 15, - ContainsDefaultValueAssignments = 1 << 16, - ContainsRestOrSpread = 1 << 17, - ContainsObjectRestOrSpread = 1 << 18, - ContainsComputedPropertyName = 1 << 19, - ContainsBlockScopedBinding = 1 << 20, - ContainsBindingPattern = 1 << 21, - ContainsYield = 1 << 22, - ContainsHoistedDeclarationOrCompletion = 1 << 23, - ContainsDynamicImport = 1 << 24, - Super = 1 << 25, - ContainsSuper = 1 << 26, + ContainsTypeScriptClassSyntax = 1 << 13, // Decorators, Property Initializers, Parameter Property Initializers + ContainsLexicalThis = 1 << 14, + ContainsCapturedLexicalThis = 1 << 15, + ContainsLexicalThisInComputedPropertyName = 1 << 16, + ContainsDefaultValueAssignments = 1 << 17, + ContainsRestOrSpread = 1 << 18, + ContainsObjectRestOrSpread = 1 << 19, + ContainsComputedPropertyName = 1 << 20, + ContainsBlockScopedBinding = 1 << 21, + ContainsBindingPattern = 1 << 22, + ContainsYield = 1 << 23, + ContainsHoistedDeclarationOrCompletion = 1 << 24, + ContainsDynamicImport = 1 << 25, + Super = 1 << 26, + ContainsSuper = 1 << 27, // Please leave this as 1 << 29. // It is the maximum bit we can set before we outgrow the size of a v8 small integer (SMI) on an x86 system. @@ -5071,6 +5073,7 @@ namespace ts { AssertTypeScript = TypeScript | ContainsTypeScript, AssertJsx = ContainsJsx, AssertESNext = ContainsESNext, + AssertES2019 = ContainsES2019, AssertES2017 = ContainsES2017, AssertES2016 = ContainsES2016, AssertES2015 = ES2015 | ContainsES2015, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 23c92216c56..357026d354f 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4601,6 +4601,7 @@ namespace ts { switch (options.target) { case ScriptTarget.ESNext: return "lib.esnext.full.d.ts"; + case ScriptTarget.ES2019: case ScriptTarget.ES2018: return "lib.es2018.full.d.ts"; case ScriptTarget.ES2017: diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index 25fa3a45050..14639381a87 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -161,7 +161,7 @@ namespace ts { start: undefined, length: undefined, }, { - messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'esnext'.", + messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, diff --git a/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts b/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts index 318bc0ceb26..e28acd241b7 100644 --- a/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts +++ b/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts @@ -238,7 +238,7 @@ namespace ts { file: undefined, start: 0, length: 0, - messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'esnext'.", + messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext'.", code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category }] diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 91f492ddd1d..d8ad3955edc 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2566,9 +2566,10 @@ declare namespace ts { ES2016 = 3, ES2017 = 4, ES2018 = 5, - ESNext = 6, + ES2019 = 6, + ESNext = 7, JSON = 100, - Latest = 6 + Latest = 7 } enum LanguageVariant { Standard = 0, diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 0e693f698f2..7465a4500cc 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2566,9 +2566,10 @@ declare namespace ts { ES2016 = 3, ES2017 = 4, ES2018 = 5, - ESNext = 6, + ES2019 = 6, + ESNext = 7, JSON = 100, - Latest = 6 + Latest = 7 } enum LanguageVariant { Standard = 0, diff --git a/tests/baselines/reference/emitter.noCatchBinding.esnext.js b/tests/baselines/reference/emitter.noCatchBinding.es2019.js similarity index 73% rename from tests/baselines/reference/emitter.noCatchBinding.esnext.js rename to tests/baselines/reference/emitter.noCatchBinding.es2019.js index f47a947ca1a..c33657960de 100644 --- a/tests/baselines/reference/emitter.noCatchBinding.esnext.js +++ b/tests/baselines/reference/emitter.noCatchBinding.es2019.js @@ -1,13 +1,14 @@ -//// [emitter.noCatchBinding.esnext.ts] +//// [emitter.noCatchBinding.es2019.ts] function f() { try { } catch { } try { } catch { try { } catch { } } try { } catch { } finally { } -} +} -//// [emitter.noCatchBinding.esnext.js] + +//// [emitter.noCatchBinding.es2019.js] function f() { try { } catch { } diff --git a/tests/baselines/reference/emitter.noCatchBinding.es2019.symbols b/tests/baselines/reference/emitter.noCatchBinding.es2019.symbols new file mode 100644 index 00000000000..54dc63597d4 --- /dev/null +++ b/tests/baselines/reference/emitter.noCatchBinding.es2019.symbols @@ -0,0 +1,11 @@ +=== tests/cases/conformance/emitter/es2019/noCatchBinding/emitter.noCatchBinding.es2019.ts === +function f() { +>f : Symbol(f, Decl(emitter.noCatchBinding.es2019.ts, 0, 0)) + + try { } catch { } + try { } catch { + try { } catch { } + } + try { } catch { } finally { } +} + diff --git a/tests/baselines/reference/emitter.noCatchBinding.esnext.types b/tests/baselines/reference/emitter.noCatchBinding.es2019.types similarity index 57% rename from tests/baselines/reference/emitter.noCatchBinding.esnext.types rename to tests/baselines/reference/emitter.noCatchBinding.es2019.types index 70c2b728a5d..79647b35dc4 100644 --- a/tests/baselines/reference/emitter.noCatchBinding.esnext.types +++ b/tests/baselines/reference/emitter.noCatchBinding.es2019.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/emitter/esnext/noCatchBinding/emitter.noCatchBinding.esnext.ts === +=== tests/cases/conformance/emitter/es2019/noCatchBinding/emitter.noCatchBinding.es2019.ts === function f() { >f : () => void @@ -8,3 +8,4 @@ function f() { } try { } catch { } finally { } } + diff --git a/tests/baselines/reference/emitter.noCatchBinding.esnext.symbols b/tests/baselines/reference/emitter.noCatchBinding.esnext.symbols deleted file mode 100644 index 91242f5b01c..00000000000 --- a/tests/baselines/reference/emitter.noCatchBinding.esnext.symbols +++ /dev/null @@ -1,10 +0,0 @@ -=== tests/cases/conformance/emitter/esnext/noCatchBinding/emitter.noCatchBinding.esnext.ts === -function f() { ->f : Symbol(f, Decl(emitter.noCatchBinding.esnext.ts, 0, 0)) - - try { } catch { } - try { } catch { - try { } catch { } - } - try { } catch { } finally { } -} diff --git a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json index ac5ebf02160..b7f98718a83 100644 --- a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json index 0e4adce88d2..452ec708540 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index 211bcb97d5f..edd4a72bd8a 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index 8c3d7be38ec..d6edb9d5c68 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json index b8dfce1ff43..ad38b2ad884 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index 60cccb8b3b3..b0107d9d742 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "lib": ["es5","es2015.promise"], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index ac5ebf02160..b7f98718a83 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index 81641589d59..8263ed18aae 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "lib": ["es5","es2015.core"], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json index 826babfd625..69249714660 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ diff --git a/tests/cases/conformance/emitter/esnext/noCatchBinding/emitter.noCatchBinding.esnext.ts b/tests/cases/conformance/emitter/es2019/noCatchBinding/emitter.noCatchBinding.es2019.ts similarity index 85% rename from tests/cases/conformance/emitter/esnext/noCatchBinding/emitter.noCatchBinding.esnext.ts rename to tests/cases/conformance/emitter/es2019/noCatchBinding/emitter.noCatchBinding.es2019.ts index 8e87b3c8c8f..d9dfb1bcd9a 100644 --- a/tests/cases/conformance/emitter/esnext/noCatchBinding/emitter.noCatchBinding.esnext.ts +++ b/tests/cases/conformance/emitter/es2019/noCatchBinding/emitter.noCatchBinding.es2019.ts @@ -1,8 +1,8 @@ -// @target: esnext +// @target: es2019 function f() { try { } catch { } try { } catch { try { } catch { } } try { } catch { } finally { } -} \ No newline at end of file +} From 1d8a2ea38c301f3ddda39aa4bdae8fe6d7c33ffe Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sun, 6 Jan 2019 11:42:55 +0900 Subject: [PATCH 2/7] Symbol.prototype.description hit stage 4 --- src/compiler/commandLineParser.ts | 3 ++- src/compiler/utilities.ts | 1 + src/lib/es2019.d.ts | 2 ++ src/lib/es2019.full.d.ts | 5 +++++ .../{esnext.symbol.d.ts => es2019.symbol.d.ts} | 0 src/lib/esnext.d.ts | 3 +-- src/lib/libs.json | 4 +++- .../unittests/config/commandLineParsing.ts | 6 +++--- tests/baselines/reference/bigintIndex.symbols | 2 +- tests/baselines/reference/dynamicNames.symbols | 2 +- .../reference/dynamicNamesErrors.symbols | 8 ++++---- .../objectLiteralPropertyImplicitlyAny.symbols | 2 +- .../unionTypeWithIndexSignature.symbols | 2 +- .../baselines/reference/uniqueSymbols.symbols | 18 +++++++++--------- .../uniqueSymbolsDeclarations.symbols | 18 +++++++++--------- .../reference/uniqueSymbolsErrors.symbols | 2 +- 16 files changed, 44 insertions(+), 34 deletions(-) create mode 100644 src/lib/es2019.d.ts create mode 100644 src/lib/es2019.full.d.ts rename src/lib/{esnext.symbol.d.ts => es2019.symbol.d.ts} (100%) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 053e09d48db..69f829d0379 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -15,6 +15,7 @@ namespace ts { ["es2016", "lib.es2016.d.ts"], ["es2017", "lib.es2017.d.ts"], ["es2018", "lib.es2018.d.ts"], + ["es2019", "lib.es2019.d.ts"], ["esnext", "lib.esnext.d.ts"], // Host only ["dom", "lib.dom.d.ts"], @@ -41,8 +42,8 @@ namespace ts { ["es2018.intl", "lib.es2018.intl.d.ts"], ["es2018.promise", "lib.es2018.promise.d.ts"], ["es2018.regexp", "lib.es2018.regexp.d.ts"], + ["es2019.symbol", "lib.es2019.symbol.d.ts"], ["esnext.array", "lib.esnext.array.d.ts"], - ["esnext.symbol", "lib.esnext.symbol.d.ts"], ["esnext.asynciterable", "lib.esnext.asynciterable.d.ts"], ["esnext.intl", "lib.esnext.intl.d.ts"], ["esnext.bigint", "lib.esnext.bigint.d.ts"] diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 357026d354f..ca83129bb3f 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4602,6 +4602,7 @@ namespace ts { case ScriptTarget.ESNext: return "lib.esnext.full.d.ts"; case ScriptTarget.ES2019: + return "lib.es2019.full.d.ts"; case ScriptTarget.ES2018: return "lib.es2018.full.d.ts"; case ScriptTarget.ES2017: diff --git a/src/lib/es2019.d.ts b/src/lib/es2019.d.ts new file mode 100644 index 00000000000..60b8787d587 --- /dev/null +++ b/src/lib/es2019.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/src/lib/es2019.full.d.ts b/src/lib/es2019.full.d.ts new file mode 100644 index 00000000000..2056578133e --- /dev/null +++ b/src/lib/es2019.full.d.ts @@ -0,0 +1,5 @@ +/// +/// +/// +/// +/// diff --git a/src/lib/esnext.symbol.d.ts b/src/lib/es2019.symbol.d.ts similarity index 100% rename from src/lib/esnext.symbol.d.ts rename to src/lib/es2019.symbol.d.ts diff --git a/src/lib/esnext.d.ts b/src/lib/esnext.d.ts index 45d7e1d96c9..6e73347bf3a 100644 --- a/src/lib/esnext.d.ts +++ b/src/lib/esnext.d.ts @@ -1,6 +1,5 @@ -/// +/// /// /// /// -/// /// diff --git a/src/lib/libs.json b/src/lib/libs.json index 3077181af6e..17b54324e9d 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -6,6 +6,7 @@ "es2016", "es2017", "es2018", + "es2019", "esnext", // Host only "dom.generated", @@ -32,10 +33,10 @@ "es2018.regexp", "es2018.promise", "es2018.intl", + "es2019.symbol", "esnext.asynciterable", "esnext.array", "esnext.bigint", - "esnext.symbol", "esnext.intl", // Default libraries "es5.full", @@ -43,6 +44,7 @@ "es2016.full", "es2017.full", "es2018.full", + "es2019.full", "esnext.full" ], "paths": { diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index 14639381a87..8d49fde6e42 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -57,7 +57,7 @@ namespace ts { assertParseResult(["--lib", "es5,invalidOption", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.symbol', 'esnext.array', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, @@ -259,7 +259,7 @@ namespace ts { assertParseResult(["--lib", "es5,", "es7", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.symbol', 'esnext.array', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, @@ -278,7 +278,7 @@ namespace ts { assertParseResult(["--lib", "es5, ", "es7", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.symbol', 'esnext.array', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, diff --git a/tests/baselines/reference/bigintIndex.symbols b/tests/baselines/reference/bigintIndex.symbols index c115a0f9daf..c0aea092753 100644 --- a/tests/baselines/reference/bigintIndex.symbols +++ b/tests/baselines/reference/bigintIndex.symbols @@ -34,7 +34,7 @@ key = "abc"; key = Symbol(); >key : Symbol(key, Decl(a.ts, 9, 3)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) key = 123n; // should error >key : Symbol(key, Decl(a.ts, 9, 3)) diff --git a/tests/baselines/reference/dynamicNames.symbols b/tests/baselines/reference/dynamicNames.symbols index cfed2817d1d..08f7be94fd5 100644 --- a/tests/baselines/reference/dynamicNames.symbols +++ b/tests/baselines/reference/dynamicNames.symbols @@ -7,7 +7,7 @@ export const c1 = 1; export const s0 = Symbol(); >s0 : Symbol(s0, Decl(module.ts, 2, 12)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) export interface T0 { >T0 : Symbol(T0, Decl(module.ts, 2, 27)) diff --git a/tests/baselines/reference/dynamicNamesErrors.symbols b/tests/baselines/reference/dynamicNamesErrors.symbols index de0d98df453..95fa0cd751e 100644 --- a/tests/baselines/reference/dynamicNamesErrors.symbols +++ b/tests/baselines/reference/dynamicNamesErrors.symbols @@ -62,19 +62,19 @@ t2 = t1; const x = Symbol(); >x : Symbol(x, Decl(dynamicNamesErrors.ts, 26, 5)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) const y = Symbol(); >y : Symbol(y, Decl(dynamicNamesErrors.ts, 27, 5)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) const z = Symbol(); >z : Symbol(z, Decl(dynamicNamesErrors.ts, 28, 5)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) const w = Symbol(); >w : Symbol(w, Decl(dynamicNamesErrors.ts, 29, 5)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) export interface InterfaceMemberVisibility { >InterfaceMemberVisibility : Symbol(InterfaceMemberVisibility, Decl(dynamicNamesErrors.ts, 29, 19)) diff --git a/tests/baselines/reference/objectLiteralPropertyImplicitlyAny.symbols b/tests/baselines/reference/objectLiteralPropertyImplicitlyAny.symbols index ae29ff8bb9e..7f61190b91f 100644 --- a/tests/baselines/reference/objectLiteralPropertyImplicitlyAny.symbols +++ b/tests/baselines/reference/objectLiteralPropertyImplicitlyAny.symbols @@ -2,7 +2,7 @@ const foo = Symbol.for("foo"); >foo : Symbol(foo, Decl(objectLiteralPropertyImplicitlyAny.ts, 0, 5)) >Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.es2015.symbol.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) >for : Symbol(SymbolConstructor.for, Decl(lib.es2015.symbol.d.ts, --, --)) const o = { [foo]: undefined }; diff --git a/tests/baselines/reference/unionTypeWithIndexSignature.symbols b/tests/baselines/reference/unionTypeWithIndexSignature.symbols index b207423057b..8d38cbb6403 100644 --- a/tests/baselines/reference/unionTypeWithIndexSignature.symbols +++ b/tests/baselines/reference/unionTypeWithIndexSignature.symbols @@ -87,7 +87,7 @@ num['0'] = 'ok' const sym = Symbol() >sym : Symbol(sym, Decl(unionTypeWithIndexSignature.ts, 18, 5)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) type Both = { s: number, '0': number, [sym]: boolean } | { [n: number]: number, [s: string]: string | number } >Both : Symbol(Both, Decl(unionTypeWithIndexSignature.ts, 18, 20)) diff --git a/tests/baselines/reference/uniqueSymbols.symbols b/tests/baselines/reference/uniqueSymbols.symbols index 6fef1873082..af2cfa74f82 100644 --- a/tests/baselines/reference/uniqueSymbols.symbols +++ b/tests/baselines/reference/uniqueSymbols.symbols @@ -2,15 +2,15 @@ // declarations with call initializer const constCall = Symbol(); >constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) let letCall = Symbol(); >letCall : Symbol(letCall, Decl(uniqueSymbols.ts, 2, 3)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) var varCall = Symbol(); >varCall : Symbol(varCall, Decl(uniqueSymbols.ts, 3, 3)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) // ambient declaration with type declare const constType: unique symbol; @@ -19,7 +19,7 @@ declare const constType: unique symbol; // declaration with type and call initializer const constTypeAndCall: unique symbol = Symbol(); >constTypeAndCall : Symbol(constTypeAndCall, Decl(uniqueSymbols.ts, 9, 5)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) // declaration from initializer const constInitToConstCall = constCall; @@ -152,26 +152,26 @@ class C { static readonly readonlyStaticCall = Symbol(); >readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbols.ts, 56, 9)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) static readonly readonlyStaticType: unique symbol; >readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbols.ts, 57, 50)) static readonly readonlyStaticTypeAndCall: unique symbol = Symbol(); >readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbols.ts, 58, 54)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) static readwriteStaticCall = Symbol(); >readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbols.ts, 59, 72)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) readonly readonlyCall = Symbol(); >readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbols.ts, 60, 42)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) readwriteCall = Symbol(); >readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbols.ts, 62, 37)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) } declare const c: C; >c : Symbol(c, Decl(uniqueSymbols.ts, 65, 13)) diff --git a/tests/baselines/reference/uniqueSymbolsDeclarations.symbols b/tests/baselines/reference/uniqueSymbolsDeclarations.symbols index 485b31af0fd..6e3ae6d6a46 100644 --- a/tests/baselines/reference/uniqueSymbolsDeclarations.symbols +++ b/tests/baselines/reference/uniqueSymbolsDeclarations.symbols @@ -2,15 +2,15 @@ // declarations with call initializer const constCall = Symbol(); >constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) let letCall = Symbol(); >letCall : Symbol(letCall, Decl(uniqueSymbolsDeclarations.ts, 2, 3)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) var varCall = Symbol(); >varCall : Symbol(varCall, Decl(uniqueSymbolsDeclarations.ts, 3, 3)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) // ambient declaration with type declare const constType: unique symbol; @@ -19,7 +19,7 @@ declare const constType: unique symbol; // declaration with type and call initializer const constTypeAndCall: unique symbol = Symbol(); >constTypeAndCall : Symbol(constTypeAndCall, Decl(uniqueSymbolsDeclarations.ts, 9, 5)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) // declaration from initializer const constInitToConstCall = constCall; @@ -152,26 +152,26 @@ class C { static readonly readonlyStaticCall = Symbol(); >readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbolsDeclarations.ts, 56, 9)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) static readonly readonlyStaticType: unique symbol; >readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbolsDeclarations.ts, 57, 50)) static readonly readonlyStaticTypeAndCall: unique symbol = Symbol(); >readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbolsDeclarations.ts, 58, 54)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) static readwriteStaticCall = Symbol(); >readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbolsDeclarations.ts, 59, 72)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) readonly readonlyCall = Symbol(); >readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbolsDeclarations.ts, 60, 42)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) readwriteCall = Symbol(); >readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbolsDeclarations.ts, 62, 37)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) } declare const c: C; >c : Symbol(c, Decl(uniqueSymbolsDeclarations.ts, 65, 13)) diff --git a/tests/baselines/reference/uniqueSymbolsErrors.symbols b/tests/baselines/reference/uniqueSymbolsErrors.symbols index affcd6f096b..2e2b552225a 100644 --- a/tests/baselines/reference/uniqueSymbolsErrors.symbols +++ b/tests/baselines/reference/uniqueSymbolsErrors.symbols @@ -238,5 +238,5 @@ declare const invalidIntersection: unique symbol | unique symbol; // https://github.com/Microsoft/TypeScript/issues/21584 const shouldNotBeAssignable: string = Symbol(); >shouldNotBeAssignable : Symbol(shouldNotBeAssignable, Decl(uniqueSymbolsErrors.ts, 86, 5)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) From 582526929b0b8e44fc28579083038520d9c55d7b Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 7 Feb 2019 10:27:50 +0900 Subject: [PATCH 3/7] restore flags --- src/compiler/types.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index a2054243e04..0ea375d0755 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5046,14 +5046,14 @@ namespace ts { ContainsTypeScript = 1 << 1, ContainsJsx = 1 << 2, ContainsESNext = 1 << 3, - ContainsES2017 = 1 << 5, - ContainsES2016 = 1 << 6, - ES2015 = 1 << 7, - ContainsES2015 = 1 << 8, - Generator = 1 << 9, - ContainsGenerator = 1 << 10, - DestructuringAssignment = 1 << 11, - ContainsDestructuringAssignment = 1 << 12, + ContainsES2017 = 1 << 4, + ContainsES2016 = 1 << 5, + ES2015 = 1 << 6, + ContainsES2015 = 1 << 7, + Generator = 1 << 8, + ContainsGenerator = 1 << 9, + DestructuringAssignment = 1 << 10, + ContainsDestructuringAssignment = 1 << 11, // Markers // - Flags used to indicate that a subtree contains a specific transformation. From 40a4bd0a958a3aaa70b6d209607f3501adf3cdad Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 7 Feb 2019 10:45:44 +0900 Subject: [PATCH 4/7] revive esnext.symbol --- src/compiler/commandLineParser.ts | 1 + src/testRunner/unittests/config/commandLineParsing.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index e7db3748d02..676e6e3520b 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -44,6 +44,7 @@ namespace ts { ["es2018.regexp", "lib.es2018.regexp.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], ["esnext.array", "lib.esnext.array.d.ts"], + ["esnext.symbol", "lib.es2019.symbol.d.ts"], ["esnext.asynciterable", "lib.esnext.asynciterable.d.ts"], ["esnext.intl", "lib.esnext.intl.d.ts"], ["esnext.bigint", "lib.esnext.bigint.d.ts"] diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index 8d49fde6e42..a79ebea1c69 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -57,7 +57,7 @@ namespace ts { assertParseResult(["--lib", "es5,invalidOption", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.symbol', 'esnext.array', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, @@ -259,7 +259,7 @@ namespace ts { assertParseResult(["--lib", "es5,", "es7", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.symbol', 'esnext.array', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, @@ -278,7 +278,7 @@ namespace ts { assertParseResult(["--lib", "es5, ", "es7", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.symbol', 'esnext.array', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, From f525a89e87069e8934db097829dc9ff74bf10d3b Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 8 Feb 2019 00:10:34 +0900 Subject: [PATCH 5/7] Array.prototype.{flat,flatMap} hit stage 4 --- lib/lib.esnext.d.ts | 1 - src/compiler/commandLineParser.ts | 3 ++- src/lib/{esnext.array.d.ts => es2019.array.d.ts} | 0 src/lib/es2019.d.ts | 1 + src/lib/libs.json | 2 +- .../unittests/config/commandLineParsing.ts | 6 +++--- tests/baselines/reference/arrayFlatMap.symbols | 14 +++++++------- tests/cases/compiler/arrayFlatMap.ts | 2 +- 8 files changed, 15 insertions(+), 14 deletions(-) rename src/lib/{esnext.array.d.ts => es2019.array.d.ts} (100%) diff --git a/lib/lib.esnext.d.ts b/lib/lib.esnext.d.ts index f213999684d..59d33ab80f4 100644 --- a/lib/lib.esnext.d.ts +++ b/lib/lib.esnext.d.ts @@ -20,7 +20,6 @@ and limitations under the License. /// /// -/// /// /// /// diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 676e6e3520b..81884b9c75d 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -42,8 +42,9 @@ namespace ts { ["es2018.intl", "lib.es2018.intl.d.ts"], ["es2018.promise", "lib.es2018.promise.d.ts"], ["es2018.regexp", "lib.es2018.regexp.d.ts"], + ["es2019.array", "lib.es2019.array.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], - ["esnext.array", "lib.esnext.array.d.ts"], + ["esnext.array", "lib.es2019.array.d.ts"], ["esnext.symbol", "lib.es2019.symbol.d.ts"], ["esnext.asynciterable", "lib.esnext.asynciterable.d.ts"], ["esnext.intl", "lib.esnext.intl.d.ts"], diff --git a/src/lib/esnext.array.d.ts b/src/lib/es2019.array.d.ts similarity index 100% rename from src/lib/esnext.array.d.ts rename to src/lib/es2019.array.d.ts diff --git a/src/lib/es2019.d.ts b/src/lib/es2019.d.ts index 60b8787d587..217d82a219c 100644 --- a/src/lib/es2019.d.ts +++ b/src/lib/es2019.d.ts @@ -1,2 +1,3 @@ /// +/// /// diff --git a/src/lib/libs.json b/src/lib/libs.json index 17b54324e9d..f1afe448f9f 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -33,9 +33,9 @@ "es2018.regexp", "es2018.promise", "es2018.intl", + "es2019.array", "es2019.symbol", "esnext.asynciterable", - "esnext.array", "esnext.bigint", "esnext.intl", // Default libraries diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index a79ebea1c69..387715fe82a 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -57,7 +57,7 @@ namespace ts { assertParseResult(["--lib", "es5,invalidOption", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, @@ -259,7 +259,7 @@ namespace ts { assertParseResult(["--lib", "es5,", "es7", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, @@ -278,7 +278,7 @@ namespace ts { assertParseResult(["--lib", "es5, ", "es7", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, diff --git a/tests/baselines/reference/arrayFlatMap.symbols b/tests/baselines/reference/arrayFlatMap.symbols index 0a97341657b..b3a8d55721a 100644 --- a/tests/baselines/reference/arrayFlatMap.symbols +++ b/tests/baselines/reference/arrayFlatMap.symbols @@ -4,17 +4,17 @@ const array: number[] = []; const readonlyArray: ReadonlyArray = []; >readonlyArray : Symbol(readonlyArray, Decl(arrayFlatMap.ts, 1, 5)) ->ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --)) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --)) array.flatMap((): ReadonlyArray => []); // ok ->array.flatMap : Symbol(Array.flatMap, Decl(lib.esnext.array.d.ts, --, --)) +>array.flatMap : Symbol(Array.flatMap, Decl(lib.es2019.array.d.ts, --, --)) >array : Symbol(array, Decl(arrayFlatMap.ts, 0, 5)) ->flatMap : Symbol(Array.flatMap, Decl(lib.esnext.array.d.ts, --, --)) ->ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --)) +>flatMap : Symbol(Array.flatMap, Decl(lib.es2019.array.d.ts, --, --)) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --)) readonlyArray.flatMap((): ReadonlyArray => []); // ok ->readonlyArray.flatMap : Symbol(ReadonlyArray.flatMap, Decl(lib.esnext.array.d.ts, --, --)) +>readonlyArray.flatMap : Symbol(ReadonlyArray.flatMap, Decl(lib.es2019.array.d.ts, --, --)) >readonlyArray : Symbol(readonlyArray, Decl(arrayFlatMap.ts, 1, 5)) ->flatMap : Symbol(ReadonlyArray.flatMap, Decl(lib.esnext.array.d.ts, --, --)) ->ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --)) +>flatMap : Symbol(ReadonlyArray.flatMap, Decl(lib.es2019.array.d.ts, --, --)) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --)) diff --git a/tests/cases/compiler/arrayFlatMap.ts b/tests/cases/compiler/arrayFlatMap.ts index dc67bf02490..98f84e78773 100644 --- a/tests/cases/compiler/arrayFlatMap.ts +++ b/tests/cases/compiler/arrayFlatMap.ts @@ -1,4 +1,4 @@ -// @lib: esnext +// @lib: es2019 const array: number[] = []; const readonlyArray: ReadonlyArray = []; From b3c179540a3b095d23d67baed57f8779809a34fb Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 8 Feb 2019 00:51:23 +0900 Subject: [PATCH 6/7] String.prototype.{trimStart,trimEnd} hit stage 4 --- src/compiler/commandLineParser.ts | 1 + src/lib/es2019.d.ts | 1 + src/lib/es2019.string.d.ts | 13 +++++++ src/lib/libs.json | 1 + .../unittests/config/commandLineParsing.ts | 6 ++-- tests/baselines/reference/bigintIndex.symbols | 2 +- tests/baselines/reference/stringTrim.js | 14 ++++++++ tests/baselines/reference/stringTrim.symbols | 24 +++++++++++++ tests/baselines/reference/stringTrim.types | 36 +++++++++++++++++++ tests/cases/compiler/stringTrim.ts | 7 ++++ 10 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 src/lib/es2019.string.d.ts create mode 100644 tests/baselines/reference/stringTrim.js create mode 100644 tests/baselines/reference/stringTrim.symbols create mode 100644 tests/baselines/reference/stringTrim.types create mode 100644 tests/cases/compiler/stringTrim.ts diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 81884b9c75d..35aeb67df8f 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -43,6 +43,7 @@ namespace ts { ["es2018.promise", "lib.es2018.promise.d.ts"], ["es2018.regexp", "lib.es2018.regexp.d.ts"], ["es2019.array", "lib.es2019.array.d.ts"], + ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], ["esnext.array", "lib.es2019.array.d.ts"], ["esnext.symbol", "lib.es2019.symbol.d.ts"], diff --git a/src/lib/es2019.d.ts b/src/lib/es2019.d.ts index 217d82a219c..b25f9e1d76a 100644 --- a/src/lib/es2019.d.ts +++ b/src/lib/es2019.d.ts @@ -1,3 +1,4 @@ /// /// +/// /// diff --git a/src/lib/es2019.string.d.ts b/src/lib/es2019.string.d.ts new file mode 100644 index 00000000000..a0cde55c2e5 --- /dev/null +++ b/src/lib/es2019.string.d.ts @@ -0,0 +1,13 @@ +interface String { + /** Removes the trailing white space and line terminator characters from a string. */ + trimEnd(): string; + + /** Removes the leading white space and line terminator characters from a string. */ + trimStart(): string; + + /** Removes the trailing white space and line terminator characters from a string. */ + trimLeft(): string; + + /** Removes the leading white space and line terminator characters from a string. */ + trimRight(): string; +} diff --git a/src/lib/libs.json b/src/lib/libs.json index f1afe448f9f..cb4e6fc053f 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -34,6 +34,7 @@ "es2018.promise", "es2018.intl", "es2019.array", + "es2019.string", "es2019.symbol", "esnext.asynciterable", "esnext.bigint", diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index 387715fe82a..3baf12bd431 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -57,7 +57,7 @@ namespace ts { assertParseResult(["--lib", "es5,invalidOption", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.string', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, @@ -259,7 +259,7 @@ namespace ts { assertParseResult(["--lib", "es5,", "es7", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.string', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, @@ -278,7 +278,7 @@ namespace ts { assertParseResult(["--lib", "es5, ", "es7", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.string', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, diff --git a/tests/baselines/reference/bigintIndex.symbols b/tests/baselines/reference/bigintIndex.symbols index c0aea092753..dff23a016ee 100644 --- a/tests/baselines/reference/bigintIndex.symbols +++ b/tests/baselines/reference/bigintIndex.symbols @@ -53,7 +53,7 @@ typedArray[bigNum] = 0xAA; // should error typedArray[String(bigNum)] = 0xAA; >typedArray : Symbol(typedArray, Decl(a.ts, 17, 5)) ->String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 2 more) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 3 more) >bigNum : Symbol(bigNum, Decl(a.ts, 16, 5)) typedArray["1"] = 0xBB; diff --git a/tests/baselines/reference/stringTrim.js b/tests/baselines/reference/stringTrim.js new file mode 100644 index 00000000000..973df9c1ebb --- /dev/null +++ b/tests/baselines/reference/stringTrim.js @@ -0,0 +1,14 @@ +//// [stringTrim.ts] +var trimmed: string; +trimmed = "abcde".trimEnd(); +trimmed = "abcde".trimStart(); +trimmed = "abcde".trimLeft(); +trimmed = "abcde".trimRight(); + + +//// [stringTrim.js] +var trimmed; +trimmed = "abcde".trimEnd(); +trimmed = "abcde".trimStart(); +trimmed = "abcde".trimLeft(); +trimmed = "abcde".trimRight(); diff --git a/tests/baselines/reference/stringTrim.symbols b/tests/baselines/reference/stringTrim.symbols new file mode 100644 index 00000000000..00f7b34d166 --- /dev/null +++ b/tests/baselines/reference/stringTrim.symbols @@ -0,0 +1,24 @@ +=== tests/cases/compiler/stringTrim.ts === +var trimmed: string; +>trimmed : Symbol(trimmed, Decl(stringTrim.ts, 0, 3)) + +trimmed = "abcde".trimEnd(); +>trimmed : Symbol(trimmed, Decl(stringTrim.ts, 0, 3)) +>"abcde".trimEnd : Symbol(String.trimEnd, Decl(lib.es2019.string.d.ts, --, --)) +>trimEnd : Symbol(String.trimEnd, Decl(lib.es2019.string.d.ts, --, --)) + +trimmed = "abcde".trimStart(); +>trimmed : Symbol(trimmed, Decl(stringTrim.ts, 0, 3)) +>"abcde".trimStart : Symbol(String.trimStart, Decl(lib.es2019.string.d.ts, --, --)) +>trimStart : Symbol(String.trimStart, Decl(lib.es2019.string.d.ts, --, --)) + +trimmed = "abcde".trimLeft(); +>trimmed : Symbol(trimmed, Decl(stringTrim.ts, 0, 3)) +>"abcde".trimLeft : Symbol(String.trimLeft, Decl(lib.es2019.string.d.ts, --, --)) +>trimLeft : Symbol(String.trimLeft, Decl(lib.es2019.string.d.ts, --, --)) + +trimmed = "abcde".trimRight(); +>trimmed : Symbol(trimmed, Decl(stringTrim.ts, 0, 3)) +>"abcde".trimRight : Symbol(String.trimRight, Decl(lib.es2019.string.d.ts, --, --)) +>trimRight : Symbol(String.trimRight, Decl(lib.es2019.string.d.ts, --, --)) + diff --git a/tests/baselines/reference/stringTrim.types b/tests/baselines/reference/stringTrim.types new file mode 100644 index 00000000000..5da0b98fb1a --- /dev/null +++ b/tests/baselines/reference/stringTrim.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/stringTrim.ts === +var trimmed: string; +>trimmed : string + +trimmed = "abcde".trimEnd(); +>trimmed = "abcde".trimEnd() : string +>trimmed : string +>"abcde".trimEnd() : string +>"abcde".trimEnd : () => string +>"abcde" : "abcde" +>trimEnd : () => string + +trimmed = "abcde".trimStart(); +>trimmed = "abcde".trimStart() : string +>trimmed : string +>"abcde".trimStart() : string +>"abcde".trimStart : () => string +>"abcde" : "abcde" +>trimStart : () => string + +trimmed = "abcde".trimLeft(); +>trimmed = "abcde".trimLeft() : string +>trimmed : string +>"abcde".trimLeft() : string +>"abcde".trimLeft : () => string +>"abcde" : "abcde" +>trimLeft : () => string + +trimmed = "abcde".trimRight(); +>trimmed = "abcde".trimRight() : string +>trimmed : string +>"abcde".trimRight() : string +>"abcde".trimRight : () => string +>"abcde" : "abcde" +>trimRight : () => string + diff --git a/tests/cases/compiler/stringTrim.ts b/tests/cases/compiler/stringTrim.ts new file mode 100644 index 00000000000..d0329b87749 --- /dev/null +++ b/tests/cases/compiler/stringTrim.ts @@ -0,0 +1,7 @@ +// @target: es2019 + +var trimmed: string; +trimmed = "abcde".trimEnd(); +trimmed = "abcde".trimStart(); +trimmed = "abcde".trimLeft(); +trimmed = "abcde".trimRight(); From 343edb6702af5d384cd4fc25d5a8c64d7638f3f6 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 8 Feb 2019 06:59:04 +0900 Subject: [PATCH 7/7] restore lib/* --- lib/lib.esnext.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/lib.esnext.d.ts b/lib/lib.esnext.d.ts index 59d33ab80f4..f213999684d 100644 --- a/lib/lib.esnext.d.ts +++ b/lib/lib.esnext.d.ts @@ -20,6 +20,7 @@ and limitations under the License. /// /// +/// /// /// ///