From 406f2c3a9d49adc6586eb28646276566de4a4b9b Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Tue, 19 Nov 2024 18:35:44 -0500 Subject: [PATCH] Fix freeVars calculation for TNominal Rather than computing the free variables of a `NominalType` definition, we only include the name of the `NominalType` itself as a free variable. Fixes #1773. --- CHANGES.md | 4 ++++ src/Cryptol/IR/FreeVars.hs | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 7bbec3ef7..d752c6146 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,10 @@ * Fix a bug in which splitting a `[0]` value into type `[inf][0]` would panic. ([#1749](https://github.com/GaloisInc/cryptol/issues/1749)) +* Fix a bug in which the free variables of types mentioning newtypes or enums + were incorrectly computed. + ([#1773](https://github.com/GaloisInc/cryptol/issues/1773)) + ## New features * REPL command `:dumptests ` updated to write to stdout when diff --git a/src/Cryptol/IR/FreeVars.hs b/src/Cryptol/IR/FreeVars.hs index b051fe770..4d3b5d330 100644 --- a/src/Cryptol/IR/FreeVars.hs +++ b/src/Cryptol/IR/FreeVars.hs @@ -159,7 +159,8 @@ instance FreeVars Type where TUser _ _ t -> freeVars t TRec fs -> freeVars (recordElements fs) - TNominal nt ts -> freeVars nt <> freeVars ts + TNominal nt ts -> mempty { tyDeps = Set.singleton (ntName nt) } + <> freeVars ts instance FreeVars TVar where freeVars tv = case tv of