Skip to content

Commit

Permalink
Apply functor instantiation map to types
Browse files Browse the repository at this point in the history
If a functor contains both a newtype and a type synonym referring to the
newtype, then during instantiation we must apply the instantiation map
to the types in the functor, so that the type synonym now refers to the
instantiated newtype instead. Previously, we only applied type
substitutions to the types in the functor, which would replace type
variables with concrete types defined in the functor arguments, but
would not replace any actual names. (Confusingly, the code refers to the
instantiation map as "value substitutions" even though it can contain
names in the type namespace. The "type substitutions" and "value
substitutions" are better thought of as "TVar -> Type mappings" and
"Name -> Name mappings".)

Fixes #1590.
  • Loading branch information
qsctr committed Nov 29, 2023
1 parent d602858 commit 89264d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Cryptol/TypeCheck/ModuleInstance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ instance ModuleInstance (ModuleG name) where
}

instance ModuleInstance Type where
moduleInstance = doTInst
moduleInstance = doTVInst

instance ModuleInstance Schema where
moduleInstance = doTInst
Expand Down

0 comments on commit 89264d6

Please sign in to comment.