-
Notifications
You must be signed in to change notification settings - Fork 2
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
Values yielded from scopes are not type-checked correctly #84
Comments
On the other hand, this code works when I didn't expect it to:
Output:
|
One more fun error with scope shenanigans:
Error message:
|
Thanks for finding these. |
One more for the pile. File name is "repro.ic":
Error message:
The correct scope state is a plain |
Update now that scopes have been overhauled. The first code snippet produces a nice error message:
The second snippet (where we use The third and fourth snippets (with |
The The more I explore scopes, the more I'm realizing that they're a fancy way to pass closures to another function (they're actually a bit more powerful than that). And so it's reasonable to think of a block itself as some sort of callable that gets passed into a scope and then invoked by the scope. The invoking scope doesn't need to care about the precise types of the parameters but only that the arguments it passes can bind. This allows us to do things like having generic blocks or having multiple blocks with the same name but different parameters (effectively an overload set). Imagine a variant visitation API:
All said, I think this would feel a lot more familiar if instead of |
This fixes the issue, but uncovers some subtlety in the lifetimes of diagnostic consumers. Currently this means that we can generate correct error messages but not stop type-checking. We also cannot highlight the source range, but that has to do with diagnostics needing to highlight across multiple files. Also in this change is some stuff to use std::stringstream less. When debugging the lifetime stuff, I started using memory-sanitizer, and it looks as though there's an existing bug in libc++ (or msan) triggering on any use of std::stringstream. Avoiding this type can help reduce the noise if we need to use msan again. Anyway, the bulk of this issue has been resolved, but I'm going to keep it open until we can generate a compilation error and stop compilation without crashing.
I suppose the larger design question is whether we want to distinguish between nullable and non-nullable references. It does feel a bit strange to use |
Minimal example:
Error message (when built with
-c dbg
):It looks like we're trying to cast the u32 value to a slice of i64 for some reason? Very strange.
Also: any ideas why the stacktrace provided by absl is so awful here?
The text was updated successfully, but these errors were encountered: