Closed robin-aws closed 3 years ago
I suspect what's confusing the code is having a symbol both implicitly defined by an import opened
statement but also exported with provides
, which should make it an OpaqueTypeDecl
. Having two definitions of the same symbol is necessary to trigger the bug only because it causes an equality check between the two types, which in turn calls NormalizeExpand
and exposes the inconsistency in both definitions.
The problem arises when the scope import opened
s two types of the same name. This ambiguous-name situation is allowed, as long as no use of the types is ambiguous. If the type are referred to by qualified names, then there is no ambiguous use. The other case where there is no ambiguity is when both types refer to the same type (for example, both may be synonyms for int
).
The crash reported in this Issue happens during this type-equality test, because the method that performs the type-equality requires the types to be visible.
Minimal reproduction below. As documented in the reference manual, it isn't an error to open modules with overlapping symbols. But attempting to re-export them seems to confuse the resolver.
Stack trace below. Note that no published release of Dafny seems to hit this. It only occurs if I build Dafny from source. This seems to imply that the assertion being violated is not actually checked in the published releases.