on master help sign in
Remove Type.Solve.allDistinct for rigid var uniqueness check
4bec0ecEvan Czaplicki
src/Type/Solve.hs−29
@@ -230,7 +230,6 @@ solveScheme scheme =
230 header' <- T.traverse flatten header
230 header' <- T.traverse flatten header
231 actuallySolve constraint
231 actuallySolve constraint
232
232
233− allDistinct rigidQuantifiers
234 youngPool <- TS.getPool
233 youngPool <- TS.getPool
235 TS.switchToPool oldPool
234 TS.switchToPool oldPool
236 generalize youngPool
235 generalize youngPool
@@ -240,34 +239,6 @@ solveScheme scheme =
240
239
241-- ADDITIONAL CHECKS
240-- ADDITIONAL CHECKS
242
241
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−
271
242
272-- Check that a variable has rank == noRank, meaning that it can be generalized.
243-- Check that a variable has rank == noRank, meaning that it can be generalized.
273isGeneric :: Variable -> TS.Solver ()
244isGeneric :: Variable -> TS.Solver ()