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/export syntax error have more specific messages #6808

Merged
merged 1 commit into from
May 23, 2023

Conversation

Akirathan
Copy link
Member

@Akirathan Akirathan commented May 23, 2023

Fixes #6425

Pull Request Description

Import and export syntax errors have more specific messages. For example, trying to compile this import:

from Standard.Table import Table as My_Table

now results in:

Compiler encountered errors:
tmp.enso[2:28-2:44]: Invalid Import: Expected identifier..
Aborting due to 1 errors and 0 warnings.

and before it was:

Compiler encountered errors:
tmp.enso[2:28-2:44]: Imports must have a valid module path.
Aborting due to 1 errors and 0 warnings.

There are more examples of these better error messages in ErrorCompilerTest.java

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@Akirathan Akirathan linked an issue May 23, 2023 that may be closed by this pull request
@Akirathan Akirathan self-assigned this May 23, 2023
@Akirathan Akirathan added the CI: No changelog needed Do not require a changelog entry for this PR. label May 23, 2023
@@ -1583,7 +1599,11 @@ hidingNames, getIdentifiedLocation(exp), false,
meta(), diag()
);
} catch (SyntaxException err) {
return err.toError(IR$Error$Syntax$InvalidImport$.MODULE$);
if (err.where instanceof Invalid invalid) {
return err.toError(invalidExportReason(invalid.getError()));
Copy link
Member Author

Choose a reason for hiding this comment

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

The underlying reason comes directly from the parser.

@Akirathan Akirathan marked this pull request as ready for review May 23, 2023 14:46
Copy link
Member

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

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

Test modifications show some improvements. Good.

@Akirathan Akirathan merged commit fe0a06d into develop May 23, 2023
@Akirathan Akirathan deleted the wip/akirathan/6425-confusing-import-error branch May 23, 2023 19:10
Procrat added a commit that referenced this pull request May 30, 2023
…le-6756-6804

* develop: (22 commits)
  Coalesce graph editor view invalidations (#6786)
  Append warnings extracted before tail call execution (#6849)
  Detect and override hooks of the same kind (#6842)
  Dynamic app resampling and better performance measurements. (#6595)
  Show spinner when opening/creating a project, take #2 (#6827)
  Infrastructure for testing inter project imports and exports (#6840)
  Only initialise visualisation chooser if it is used. (#6758)
  Allow casting a Mixed column into a concrete type (#6777)
  Stop graph editing when in full-screen visualization mode (#6844)
  Handle `show-dashboard` event (#6837)
  Fix some dashboard issues (#6668)
  Fix JWT leak (#6815)
  Fix "set username" screen (#6824)
  Fallback to opened date when ordering projects (#6814)
  Various test improvements to increase coverage and speed things up (#6820)
  do not activate nested dropdowns together (#6830)
  Clearly select single specialization with enum dispatch pattern (#6819)
  Prevent incorrect application of list widget on incompatible expressions (#6771)
  Update GraalVM to 22.3.1 JDK17 (#6750)
  Import/export syntax error have more specific messages (#6808)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusing import error
2 participants