wrong "Incompatible types" error with generic classes #228
Labels
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: M-Labs/nac3#228
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Based on https://github.com/m-labs/artiq/issues/1207
Commenting out either the
c0
or thec1
field makes the error disappear.There should still be some deeper bugs since this patch only non-deterministically fix the bug (other times fails with another bug
thread '<unnamed>' panicked at 'internal error: entered unreachable code: T', nac3core/src/codegen/mod.rs:323:18
..).. but hope this can be of some help: I think the type cache for recursive type should be inserted with key python object id instead of the type id for generic classes, the when cache should be updated when the previously obtained generic type is resolved to a concrete type41d62f7325
This one is a bit tricky... There are multiple reasons, including the fix Anto mentioned above, and a bug in composer. The composer will put a dummy typevar for each field, and unify the dummy typevar with a concrete type later. However, the field may contain typevars that we need to substitute, and we cannot substitute it if we only have the dummy typevar, thus the non-deterministic behavior (this depends on the order we perform the unifications). The fix is to put those classes with generic type parameters at the end,