mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-11-04 19:25:27 -07:00
checked that course of value tables (table P [...]) have the correct number of values w.r.t the type P. This was previously not checked, and caused hard-to-find run-time errors.
This commit is contained in:
1 parent
ca1cad68d0
commit
aef787aeb1
2 files changed
+8
No files matched your search
@@ -436,6 +436,10 @@ checkLType gr g trm typ0 = do
|
||||
case typ of
|
||||
Table arg1 val ->
|
||||
do arg' <- checkEqLType gr g arg0 arg1 trm
|
||||
vs1 <- allParamValues gr arg1
|
||||
if length vs1 == length vs
|
||||
then return ()
|
||||
else checkError $ text "wrong number of values in table" <+> ppTerm Unqualified 0 trm
|
||||
vs' <- map fst `fmap` sequence [checkLType gr g v val|v<-vs]
|
||||
return (V arg' vs',typ)
|
||||
|
||||
|
||||
@@ -468,6 +468,10 @@ checkLType gr g trm typ0 = do
|
||||
case typ of
|
||||
Table arg1 val ->
|
||||
do arg' <- checkEqLType gr g arg0 arg1 trm
|
||||
vs1 <- allParamValues gr arg1
|
||||
if length vs1 == length vs
|
||||
then return ()
|
||||
else checkError $ "wrong number of values in table" <+> ppTerm Unqualified 0 trm
|
||||
vs' <- map fst `fmap` sequence [checkLType gr g v val|v<-vs]
|
||||
return (V arg' vs',typ)
|
||||
|
||||
|
||||
Reference in new issue
Block a user