on master help sign in
Remove Type.Solve.allDistinct for rigid var uniqueness check

In previous versions this was dead code because rigidQuantifiers was always an empty list. This rule is actually enforced during unification in the current code, and that means we can give more specific errors.

commit4bec0ecfa2e006498277300d38e3cbf0b61e5f73 authorEvan Czaplicki <evancz@users.noreply.github.com> dateTue 20 Sep 2016, 00:45 (10 years ago) parenta5b21a1
1 file changed−29
src/Type/Solve.hs−29
src/Type/Solve.hs−29
@@ -230,7 +230,6 @@ solveScheme scheme =
230230 header' <- T.traverse flatten header
231231 actuallySolve constraint
232232
233− allDistinct rigidQuantifiers
234233 youngPool <- TS.getPool
235234 TS.switchToPool oldPool
236235 generalize youngPool
@@ -240,34 +239,6 @@ solveScheme scheme =
240239
241240-- ADDITIONAL CHECKS
242241
243−-- Checks that all of the given variables belong to distinct equivalence classes.
244−-- Also checks that their structure is Nothing, so they represent a variable, not
245−-- a more complex term.
246−allDistinct :: [Variable] -> TS.Solver ()
247−allDistinct vars =
248− do seenMark <- TS.uniqueMark
249− forM_ vars $ \var ->
250− do desc <- liftIO $ UF.descriptor var
251− case _content desc of
252− Structure _ ->
253− crash "Can only generalize type variables, not structures."
254−
255− Atom _ ->
256− crash "Can only generalize type variables, not structures."
257−
258− Alias _ _ _ ->
259− crash "Can only generalize type variables, not aliases."
260−
261− Error ->
262− crash "Can only generalize type variables, not error types."
263−
264− Var _ _ _ ->
265− if _mark desc == seenMark then
266− crash "Duplicate variable during generalization."
267−
268− else
269− liftIO (UF.setDescriptor var (desc { _mark = seenMark }))
270−
271242
272243-- Check that a variable has rank == noRank, meaning that it can be generalized.
273244isGeneric :: Variable -> TS.Solver ()