Don't allow uppercase pattern variables

This commit is contained in:
2026-02-20 16:12:54 -08:00
parent 7d5789147d
commit c54b856f0b
5 changed files with 24 additions and 2 deletions

View File

@@ -1001,7 +1001,10 @@ mkPat (tm, icit) = do
-- Just _ => error (getFC tm) "\{show nm} is not a data constructor"
_ => case b of
-- TODO maybe check case?
Nil => pure $ PatVar fc icit nm
Nil =>
if isUpperName nm
then error (getFC tm) "\{nm} not in scope"
else pure $ PatVar fc icit nm
_ => error (getFC tm) "patvar applied to args"
((RImplicit fc), Nil) => pure $ PatWild fc icit
((RImplicit fc), _) => error fc "implicit pat can't be applied to arguments"