Skip to content

Speed up valid hole-fits by adding a fail-fast path for non-fits

Matthías Páll Gissurarson requested to merge Tritlo/ghc:fix-16875 into master

Speed up valid hole-fits by adding early abort and checks.

By adding an early abort flag in TcSEnv, we can fail fast in the presence of insoluble constraints. This helps us avoid a lot of work in valid hole-fits, and we geta massive speed-up by avoiding a lot of useless work solving constraints that never come into play.

Additionally, we add a simple check for degenerate hole types, such as when the type of the hole is an immutable type variable (as is the case when the hole is completely unconstrained). Then the only valid fits are the locals, so we can ignore the global candidates.

This fixes #16875 (closed)

Edited by Matthías Páll Gissurarson

Merge request reports