Skip to content
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

Use UNKNOWN_LOCATION if node location does not exist #1378

Merged
merged 1 commit into from
Mar 26, 2023

Conversation

ianyong
Copy link
Member

@ianyong ianyong commented Mar 26, 2023

This change is necessary for multiple file programs to work correctly in the frontend. This is because the AST nodes which are added by the preprocessor do not have a corresponding location (due to not being parsed from code in the first place). One of the instances of .loc! is being called (no idea which because it's almost impossible to trace without proper error handling), resulting in the evaluation of multiple-file programs dying.

We really should ban the use of the non-null assertion operator (!). Its only purpose is to let lazy programmers write code that bypass the type checker.

Part of source-academy/frontend#2176.

Verified

This commit was signed with the committer’s verified signature.
ianyong Ian Yong
@ianyong ianyong requested a review from zhaojj2209 March 26, 2023 09:54
@coveralls
Copy link

Pull Request Test Coverage Report for Build 4523966829

  • 107 of 111 (96.4%) changed or added relevant lines in 34 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 83.517%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/interpreter/interpreter-non-det.ts 3 4 75.0%
src/parser/source/rules/noEval.ts 1 2 50.0%
src/typeChecker/internalTypeErrors.ts 2 3 66.67%
src/utils/operators.ts 2 3 66.67%
Totals Coverage Status
Change from base Build 4496667413: -0.1%
Covered Lines: 10225
Relevant Lines: 11863

💛 - Coveralls

Copy link
Contributor

@zhaojj2209 zhaojj2209 left a comment

Choose a reason for hiding this comment

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

LGTM

@ianyong ianyong merged commit 4a6845a into master Mar 26, 2023
@ianyong ianyong deleted the use-unknown-location-if-location-does-not-exist branch March 26, 2023 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants