Skip to content

fix: --use cause compile crash (#2225) #2227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/diagnosticMessages.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export enum DiagnosticCode {
Property_0_is_missing_in_type_1_but_required_in_type_2 = 2741,
Type_0_has_no_call_signatures = 2757,
File_0_not_found = 6054,
no_such_global_element_0 = 6055,
Numeric_separators_are_not_allowed_here = 6188,
Multiple_consecutive_numeric_separators_are_not_permitted = 6189,
_super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class = 17009,
Expand Down Expand Up @@ -374,6 +375,7 @@ export function diagnosticCodeToString(code: DiagnosticCode): string {
case 2741: return "Property '{0}' is missing in type '{1}' but required in type '{2}'.";
case 2757: return "Type '{0}' has no call signatures.";
case 6054: return "File '{0}' not found.";
case 6055: return "no such global element: '{0}'";
case 6188: return "Numeric separators are not allowed here.";
case 6189: return "Multiple consecutive numeric separators are not permitted.";
case 17009: return "'super' must be called before accessing 'this' in the constructor of a derived class.";
Expand Down
1 change: 1 addition & 0 deletions src/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
"Type '{0}' has no call signatures.": 2757,

"File '{0}' not found.": 6054,
"no such global element: '{0}'":6055,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diagnostic 6055 is different in TypeScript, and we try to prevent collisions there. What seems to fit, though, is to renumber this diagnostic to 110 and move it up to the 1XX range of custom AS compiler errors.

Error ranges are about:

  • 100-199: Custom AS compiler errors
  • 200-899: Custom AS compilation diagnostics
  • 900-999: Pedantic diagnostics
  • 1000+: Reused TypeScript errors

"Numeric separators are not allowed here.": 6188,
"Multiple consecutive numeric separators are not permitted.": 6189,
"'super' must be called before accessing 'this' in the constructor of a derived class.": 17009,
Expand Down
2 changes: 1 addition & 1 deletion src/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,7 @@ export class Program extends DiagnosticEmitter {
if (elementsByName.has(name)) {
elementsByName.set(alias, assert(elementsByName.get(name)));
} else {
throw new Error("no such global element: " + name);
this.error(DiagnosticCode.no_such_global_element_0, null, name);
}
}
}
Expand Down