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

Import error diagnostic is incomplete. #271

Closed
zong-zhe opened this issue Oct 31, 2022 · 3 comments
Closed

Import error diagnostic is incomplete. #271

zong-zhe opened this issue Oct 31, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request error-handling Issues or PRs related to kcl error handling help wanted Extra attention is needed

Comments

@zong-zhe
Copy link
Contributor

Enhancement

At present, the error diagnostic output about import in KCL is as follows.

KCL:

import math as m // `mt` is written as `m` here by mistake.

two = mt.log10(100)

The diagnositc:

KCL Compile Error[E2L23] : A complie error occurs during compiling
---> File /KCLVM/test/grammar/import/builtin_import_as/main.k:3:7
3 |two = mt.log10(100)
       7 ^  -> Failure
name 'mt' is not defined

This doesn't help much for helping the user find where the typo.
Maybe we should learn rust.
It is more useful to output such diagnostic information.

KCL Compile Error[E2L23] : A complie error occurs during compiling
---> File /KCLVM/test/grammar/import/builtin_import_as/main.k:3:7
3 |two = mt.log10(100)
       7 ^  -> Failure
name 'mt' is not defined

help: consider importing one of these items
   |
0  |    import math as mt 
   |
0  |    import mt
@zong-zhe zong-zhe added the enhancement New feature or request label Oct 31, 2022
@zong-zhe zong-zhe added this to the v0.4.4 Release milestone Oct 31, 2022
@zong-zhe zong-zhe self-assigned this Oct 31, 2022
@Peefy Peefy modified the milestones: v0.4.4 Release, v0.4.5 Release Dec 4, 2022
@Peefy Peefy added the error-handling Issues or PRs related to kcl error handling label Feb 20, 2023
@Peefy Peefy modified the milestones: v0.4.5 Release, v0.4.6 Release Feb 20, 2023
@Peefy Peefy removed this from the v0.4.6 Release milestone Apr 10, 2023
@Peefy Peefy added the help wanted Extra attention is needed label Apr 10, 2023
@Peefy Peefy added this to the v0.5.0 Release milestone Apr 17, 2023
@Peefy Peefy removed this from the v0.5.0 Release milestone Jul 6, 2023
@Peefy Peefy added this to the v0.6.0 Release milestone Jul 17, 2023
@Peefy Peefy modified the milestones: v0.6.0 Release, v0.7.0 Release Sep 11, 2023
@zong-zhe
Copy link
Contributor Author

zong-zhe commented Sep 25, 2023

At this stage, if the suggestions in KCL error message need to be pointed to the specific import statements, more semantic analysis is needed.

Because only rely on an incorrect name, cannot tell whether the incorrect name is an incorrect import statement name or an incorrect schema instance name, and so on.

This part of the work relies on more detailed semantic analysis, and we plan to leave it to the LSP to help the IDE display error messages more clearly. Therefore, I will add a suggestion to the error messages on the language side to help users better understand the error messages. like #715

@i-zhen
Copy link
Contributor

i-zhen commented Sep 26, 2023

Good choice

@Peefy
Copy link
Contributor

Peefy commented Nov 6, 2023

Closed by #731

@Peefy Peefy closed this as completed Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request error-handling Issues or PRs related to kcl error handling help wanted Extra attention is needed
Projects
No open projects
Status: v0.7.0 Release Done
Development

No branches or pull requests

3 participants