-
Notifications
You must be signed in to change notification settings - Fork 8
Implement basic diagnostic rendering #87
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
Open
purefunctor
wants to merge
56
commits into
main
Choose a base branch
from
diagnostics-crate
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This refactors the error reporting in the checking crate to render local types eagerly. This is a pre-requisite for creating a diagnostics crate, which will be used for the LSP's error reporting and integration tests.
This introduces the significant_ranges function in diagnostics::context to extract the significant ranges in a node. Annotations are attached to InstanceDeclaration, not InstanceChain; this makes it impossible for the naive Annotation-stripping approach to work, leading to confusing offsets during diagnostic reporting.
This improves inference for do statements by using a unification variable as a stand-in for the innermost expression when emulating desugard bind/discard expressions. Inferring the pure_expression too early causes the unification variables we created for the do statement binders to be solved too eagerly; in the case of 215, the error becomes associated to `pure "life"` rather than `add a b`.
This adds a missing unification rule for Type::Variable, which relied on an ID-based check before inline kinds were introduced.
This fixes an issue where `discard` is eagerly required when checking do expressions, even on expressions that only ever use `bind`. This lazy resolution is necessary as `bind` and `discard` are canonically defined in separate modules, `Control.Bind` and `Control.Discard`. In addition to lazy resolution, if `discard` cannot be resolved, the compiler synthesises a type that would match most of its general usages, outside of non-monadic definitions of `bind` and `discard`.
Extends the lazy discard pattern from d18813a to all rebindable do/ado functions. Resolution and error reporting now only occurs when the function is actually needed: Do-notation: - bind: only when <- statements exist - discard: only when non-final discard statements exist (unchanged) Ado-notation: - 0 actions: only pure needed - 1 action: only map needed - 2+ actions: map + apply needed When a needed function is missing, a constraint-free synthetic type is used to allow type checking to continue with useful inference. This improves error recovery and avoids spurious 'not in scope' errors for unused functions. Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019bffd6-adf2-777c-bfdb-dcc91b5b504f
- Rename synth_* to lookup_or_synthesise_* taking Option<Resolution> - Use with_position() for allocation-free final-position checks - Only synthesise bind/discard types for non-final actions - Reduces unification variable count in do-blocks Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c00d9-1df4-778e-80f0-14a15fd7abf4g
This adds the InvalidFinalBind warning and InvalidFinalLet error to inform the user that the final statement in a do expression is invalid. For bind statements, the expression can be used to recover the type of the do expression had it been a discard statement instead. Co-authored-by: Amp <[email protected]> Amp-Thread: https://ampcode.com/threads/T-019c00ee-da00-73df-b838-016a21109a08
An invalid kind for the function position in infer_surface_app_kind prevented implicit type variable arguments from being bound onto the environment. This was demonstrated by 251_lookup_implicit_panic which triggers a panic on the use of the type variable `a` on the instance declaration body. This commit adds inference for the `argument_t`, returning the elaborated type and an unknown kind for the application.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.