mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-15 15:59:32 -06:00
When projecting a non-existent field, return Prelude.False
This seems to be GF's own behaviour, as exhibited by the canonical version of PhrasebookTha:
NNumeral Numeral_0 = {s = Numeral_0.s; hasC = <>.hasC};
This commit is contained in:
@@ -157,7 +157,11 @@ mkCanon2lpgf opts gr am = do
|
||||
-- find label index in argument type
|
||||
let Just (C.RecordType rrs) = mtyp
|
||||
let rrs' = [ lid | C.RecordRow lid _ <- rrs ]
|
||||
lblIx <- eitherElemIndex lblId rrs'
|
||||
-- lblIx <- eitherElemIndex lblId rrs'
|
||||
let
|
||||
lblIx = case eitherElemIndex lblId rrs' of
|
||||
Right x -> x
|
||||
Left _ -> 0 -- corresponds to Prelude.False
|
||||
-- lookup lintype for record row
|
||||
let C.RecordRow _ lt = rrs !! lblIx
|
||||
return (L.LFProjection v1' (L.LFInt (lblIx+1)), Just lt)
|
||||
|
||||
Reference in New Issue
Block a user