Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3ed2e8e
Report unreachable on enums (#58380)
jakebailey Aug 15, 2024
90da3ca
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Aug 15, 2024
20f26a4
allow `generateTrace` in tsconfig and compiler API (#59636)
dimitropoulos Aug 15, 2024
a053072
Improve inlining of string variables in template literals (#54849)
Zzzen Aug 15, 2024
aaa6c4e
Add an extra test case for narrowing of union containing a type param…
Andarist Aug 15, 2024
5fd6a6f
Revert of Search ancestor and its references for default projects #57…
sheetalkamat Aug 15, 2024
bcb1545
Allow existing imports in file to supersede package.json filter (#59604)
andrewbranch Aug 15, 2024
ca64946
Set parents of augmented module exports (#59609)
andrewbranch Aug 15, 2024
5239589
Set declarationMap to false in transpileModule. (#59642)
dragomirtitian Aug 15, 2024
856e472
Do not overwrite original pointer when indirectly points to location …
rbuckton Aug 16, 2024
09a8522
Do not get awaited type of AsyncGenerator TNext (#59644)
rbuckton Aug 16, 2024
f025a5b
built-in iterators should be disposable (#59633)
rbuckton Aug 16, 2024
26c4320
also return classes when caling goToDef on a constructor call (#59421)
iisaduan Aug 16, 2024
8ec3804
fix test/basellines (#59663)
iisaduan Aug 16, 2024
f850298
fix(59558): Implement Interface Quick Fix generates duplicate declara…
a-tarasyuk Aug 16, 2024
d06fb82
Add option --stopBuildOnErrors to tsbuild to get previous behavior of…
sheetalkamat Aug 17, 2024
2a8865e
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Aug 17, 2024
577155f
Bump github/codeql-action from 3.26.0 to 3.26.2 in the github-actions…
dependabot[bot] Aug 19, 2024
936a79b
Expose TypeChecker. getAwaitedType to public (#59268)
yeonjuan Aug 19, 2024
1e7889c
Enable existing commit characters in certain locations where `isNewId…
gabritto Aug 19, 2024
bff6aa1
Use correct line endings in built typesMap.json (#59687)
jakebailey Aug 19, 2024
6894ff7
Fix Set of one string literal bug in openExternalProject (#59686)
jakebailey Aug 19, 2024
e6edc56
Fixed an issue with contextual type for intersection properties (take…
Andarist Aug 19, 2024
12d7c85
Bump version to 5.7 (#59693)
DanielRosenwasser Aug 20, 2024
2192336
Fixing delay caused in vscode due to pasteEdits (#59542)
navya9singh Aug 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0
uses: github/codeql-action/init@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2
with:
config-file: ./.github/codeql/codeql-configuration.yml
# Override language selection by uncommenting this and choosing your languages
Expand All @@ -56,7 +56,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below).
- name: Autobuild
uses: github/codeql-action/autobuild@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0
uses: github/codeql-action/autobuild@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -70,4 +70,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0
uses: github/codeql-action/analyze@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: 'Upload to code-scanning'
uses: github/codeql-action/upload-sarif@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0
uses: github/codeql-action/upload-sarif@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion Herebyfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ export const generateTypesMap = task({
const target = "built/local/typesMap.json";
const contents = await fs.promises.readFile(source, "utf-8");
JSON.parse(contents); // Validates that the JSON parses.
await fs.promises.writeFile(target, contents);
await fs.promises.writeFile(target, contents.replace(/\r\n/g, "\n"));
},
});

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "5.6.0",
"version": "5.7.0",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
Expand Down
52 changes: 29 additions & 23 deletions src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ import {
isEmptyObjectLiteral,
isEntityNameExpression,
isEnumConst,
isEnumDeclaration,
isExportAssignment,
isExportDeclaration,
isExportsIdentifier,
Expand Down Expand Up @@ -3789,7 +3788,9 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
(isStatementButNotDeclaration(node) && node.kind !== SyntaxKind.EmptyStatement) ||
// report error on class declarations
node.kind === SyntaxKind.ClassDeclaration ||
// report error on instantiated modules or const-enums only modules if preserveConstEnums is set
// report errors on enums with preserved emit
isEnumDeclarationWithPreservedEmit(node, options) ||
// report error on instantiated modules
(node.kind === SyntaxKind.ModuleDeclaration && shouldReportErrorOnModuleDeclaration(node as ModuleDeclaration));

if (reportError) {
Expand All @@ -3813,15 +3814,19 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
node.declarationList.declarations.some(d => !!d.initializer)
);

eachUnreachableRange(node, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
eachUnreachableRange(node, options, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
}
}
}
return true;
}
}

function eachUnreachableRange(node: Node, cb: (start: Node, last: Node) => void): void {
function isEnumDeclarationWithPreservedEmit(node: Node, options: CompilerOptions): boolean {
return node.kind === SyntaxKind.EnumDeclaration && (!isEnumConst(node as EnumDeclaration) || shouldPreserveConstEnums(options));
}

function eachUnreachableRange(node: Node, options: CompilerOptions, cb: (start: Node, last: Node) => void): void {
if (isStatement(node) && isExecutableStatement(node) && isBlock(node.parent)) {
const { statements } = node.parent;
const slice = sliceAfter(statements, node);
Expand All @@ -3830,26 +3835,27 @@ function eachUnreachableRange(node: Node, cb: (start: Node, last: Node) => void)
else {
cb(node, node);
}
}
// As opposed to a pure declaration like an `interface`
function isExecutableStatement(s: Statement): boolean {
// Don't remove statements that can validly be used before they appear.
return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && !isEnumDeclaration(s) &&
// `var x;` may declare a variable used above
!(isVariableStatement(s) && !(getCombinedNodeFlags(s) & (NodeFlags.BlockScoped)) && s.declarationList.declarations.some(d => !d.initializer));
}

function isPurelyTypeDeclaration(s: Statement): boolean {
switch (s.kind) {
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.TypeAliasDeclaration:
return true;
case SyntaxKind.ModuleDeclaration:
return getModuleInstanceState(s as ModuleDeclaration) !== ModuleInstanceState.Instantiated;
case SyntaxKind.EnumDeclaration:
return hasSyntacticModifier(s, ModifierFlags.Const);
default:
return false;
// As opposed to a pure declaration like an `interface`
function isExecutableStatement(s: Statement): boolean {
// Don't remove statements that can validly be used before they appear.
return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) &&
// `var x;` may declare a variable used above
!(isVariableStatement(s) && !(getCombinedNodeFlags(s) & (NodeFlags.BlockScoped)) && s.declarationList.declarations.some(d => !d.initializer));
}

function isPurelyTypeDeclaration(s: Statement): boolean {
switch (s.kind) {
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.TypeAliasDeclaration:
return true;
case SyntaxKind.ModuleDeclaration:
return getModuleInstanceState(s as ModuleDeclaration) !== ModuleInstanceState.Instantiated;
case SyntaxKind.EnumDeclaration:
return !isEnumDeclarationWithPreservedEmit(s, options);
default:
return false;
}
}
}

Expand Down
Loading