Skip to content

Commit

Permalink
Change transDatDcl.newtCheck to take SymT
Browse files Browse the repository at this point in the history
  • Loading branch information
matil019 committed Oct 31, 2019
1 parent d39d409 commit b2fec3f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frege/compiler/passes/Transdef.fr
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,10 @@ transDatDcl env fname (d@DatDcl {pos}) = do
foreach d.ctrs (transCon sym.typ (MName tname))
foreach d.defs (transdef [] (MName tname))
polymorphicFields tname
U.findT tname >>= newtCheck . SymbolT.T
U.findT tname >>= newtCheck
other -> do E.fatal pos (text ("Cannot happen, data " ++ tname.nice g ++ " missing"))
where
newtCheck (SymbolT.T (symt@SymT{newt=true})) -- this is declared as newtype
newtCheck (symt@SymT{newt=true}) -- this is declared as newtype
| [con] [ c | SymbolT.D c <- values symt.env ], -- so it has 1 constructor
[fld] [ f | f@Field {typ} <- con.flds ], -- with 1 field
ForAll _ RhoTau{tau} fld.typ, -- which has some type tau
Expand All @@ -489,7 +489,7 @@ transDatDcl env fname (d@DatDcl {pos}) = do
changeSym $ SymbolT.T symt.{newt=false} -- make it data
changeSym $ SymbolT.D con.{flds <- map _.{strict=true}} -- with strict field
pure ()
newtCheck other = pure ()
newtCheck _ = pure ()
polymorphicFields tname = do
symt <- U.findT tname
let cons = [ c | SymbolT.D c <- values symt.env ]
Expand Down

0 comments on commit b2fec3f

Please sign in to comment.