-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Some issues after importing tables module (with iterators?) #8064
Comments
import tables
let t = {"a": 1, "b":2}.newTable
for x in values(t):
echo x I agree that the error messages you got were not very informative |
@andreaferretti |
I agree - the errors should be handled and reporting should be improved. That's why I added the |
Example 4 gives proper(?) error messages on devel. Reduced code for example 3: type
A = object
B = object
proc values[T](o: A, x: T): T = x
proc values[T](o: B, x: T): T = x
values[1] |
I think only example 1 should take care of for current stage. like |
|
refs #8064, refs #24010 Error messages for standalone explicit generic instantiations are revamped. Failing standalone explicit generic instantiations now only error after overloading has finished and resolved to the default `[]` magic (this means `[]` can now be overloaded for procs but this isn't necessarily intentional, in #24010 it was documented that it isn't possible). The error messages for failed instantiations are also no longer a simple `cannot instantiate: foo` message, instead they now give the same type mismatch error message as overloads with mismatching explicit generic parameters. This is now possible due to the changes in #24010 that delegate all explicit generic proc instantiations to overload resolution. Old code that worked around this is now removed. `maybeInstantiateGeneric` could maybe also be removed in favor of just `explicitGenericSym`, the `result == n` case is due to `explicitGenericInstError` which is only for niche cases. Also, to cause "ambiguous identifier" error messages when the explicit instantiation is a symchoice and the expression context doesn't allow symchoices, we semcheck the sym/symchoice created by `explicitGenericSym` with the given expression flags. #8064 isn't entirely fixed because the error message is still misleading for the original case which does `values[1]`, as a consequence of #12664.
Sorry, my nim skills are too low to narrow the issues anymore. The only thing I know is that
values
in the below snippets is some iterator from tables module. And since i don't even know what the reason of the crash is, I cannot even search github for existing issues.1
Code:
gives
2. Adding discard to the above code gives -
In the first snippet the compiler asks to discard value but now it says that nothing can be discarded.
3. This code crashes compiler
crashes compiler with -
Koch gives -
4. This code also crashes compiler
Koch gives
The text was updated successfully, but these errors were encountered: