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

Fix(resolver): fix incorrect position info of CannotFindModule Error. #128

Merged
merged 1 commit into from
Aug 1, 2022

Conversation

He1pa
Copy link
Contributor

@He1pa He1pa commented Jul 27, 2022

1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

2. What is the scope of this PR (e.g. component or file name):

sema/resolver/global.rs
sema/resolver/import.rs

3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Other

There is an incorrect position of ConnotFindModule Error. When a CannotFindModule error is triggered (e.g., importing a non-existent file), the error message is indicated at x:2(line: x and column: 2), but by convention it should be x:1 or just line x. Now fix it to just output the line number.

KCL Error [CannotFindModule]
---> File ./test.k:1
1 |import non_existent_file

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

  • N
  • Y

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

  • Unit test
  • Integration test
  • Benchmark (add benchmark stats below)
  • Manual test (add detailed scripts or steps below)
  • Other

6. Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@He1pa He1pa added the bug Something isn't working label Jul 27, 2022
@He1pa He1pa added this to the v0.4.3 Release milestone Jul 27, 2022
@coveralls
Copy link
Collaborator

coveralls commented Jul 27, 2022

Pull Request Test Coverage Report for Build 2772064760

  • 11 of 13 (84.62%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.09%) to 59.447%

Changes Missing Coverage Covered Lines Changed/Added Lines %
kclvm/sema/src/resolver/global.rs 0 1 0.0%
kclvm/sema/src/resolver/import.rs 1 2 50.0%
Totals Coverage Status
Change from base Build 2758774952: 0.09%
Covered Lines: 22288
Relevant Lines: 37492

💛 - Coveralls

@Peefy Peefy added resolver error-handling Issues or PRs related to kcl error handling labels Jul 27, 2022
@He1pa He1pa force-pushed the fix_CannotFindModule_err_position branch from 7ab00f1 to e9802b4 Compare July 28, 2022 02:52
@He1pa He1pa changed the title [WIP] Fix(resolver): fix incorrect position info of CannotFindModule Error. Fix(resolver): fix incorrect position info of CannotFindModule Error. Jul 28, 2022
Peefy
Peefy previously approved these changes Jul 29, 2022
Copy link
Contributor

@Peefy Peefy left a comment

Choose a reason for hiding this comment

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

LGTM

There is an incorrect position of ConnotFindModule Error. When a CannotFindModule error is triggered (e.g., importing a non-existent file), the error message is indicated at x:2(line: x and column: 2), but by convention it should be x:1 or just line x. Now fix it to just output the line number.
```
KCL Error [CannotFindModule]
---> File ./test.k:1
1 |import non_existent_file
```

fix kcl-lang#126
Copy link
Contributor

@zong-zhe zong-zhe left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Peefy Peefy left a comment

Choose a reason for hiding this comment

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

LGTM

@He1pa He1pa merged commit fa5af63 into kcl-lang:main Aug 1, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Aug 1, 2022
Copy link
Contributor

@chai2010 chai2010 left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working error-handling Issues or PRs related to kcl error handling resolver
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug Report: The position information in the KCL error message is incorrect.
5 participants