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(compiler): Return error if SemanticError occures [LNG-356] #1126

Merged
merged 8 commits into from
Apr 17, 2024

Conversation

DieMyst
Copy link
Member

@DieMyst DieMyst commented Apr 15, 2024

Description

VSCode shows incorrect errors in exported functions

Proposed Changes

Turn state with errors to CompileError

Implementation Details

Because lsp creates context on errors too, it breaks on finalising headers and shows incorrect error.

Checklist

  • Corresponding issue has been created and linked in PR title.
  • Proposed changes are covered by tests.
  • Documentation has been updated to reflect the changes (if applicable).
  • I have self-reviewed my code and ensured its quality.
  • I have added/updated necessary comments to aid understanding.

Reviewer Checklist

  • Tests have been reviewed and are sufficient to validate the changes.
  • Documentation has been reviewed and is up to date.
  • Any questions or concerns have been addressed.

Copy link

linear bot commented Apr 15, 2024

@DieMyst DieMyst added the e2e Run e2e workflow label Apr 16, 2024
@DieMyst DieMyst marked this pull request as ready for review April 16, 2024 08:07
Raw.error("Failed to resolve default service id")
): EitherT[Alg, Raw, ServiceRaw] = {
def errored = ErroredPart(expr.name.value)
for {
Copy link
Contributor

Choose a reason for hiding this comment

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

If error is always the same, this whole for could be rewritten to for on OptionT and converted to EitherT at the very end.

@@ -23,4 +24,15 @@ trait Semantics[S[_], C] {
ast: Ast[S],
init: C
): ProcessResult

def stateToResult(state: CompilerState[S], ctx: C): ProcessResult =
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make it method of the CompilerState or object Semantics? It is strange for it to be a method of semantics trait, it is connected to it only by return type

@DieMyst DieMyst enabled auto-merge (squash) April 17, 2024 11:59
@DieMyst DieMyst merged commit e6c5d00 into main Apr 17, 2024
9 checks passed
@DieMyst DieMyst deleted the LNG-356_wrong_error_in_lsp branch April 17, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run e2e workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants