Skip to content

Commit ddccca6

Browse files
authored
[ upstream ] Update elab for WithFC (#77)
* fix elab for WithFC * Fix elab-doc
1 parent 61a57dd commit ddccca6

File tree

7 files changed

+16
-13
lines changed

7 files changed

+16
-13
lines changed

src/Doc/Enum1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ enumDecl1 name cons = IData EmptyFC (specified Public) Nothing dat
6868
enumName = UN $ Basic name
6969
7070
mkCon : String -> ITy
71-
mkCon n = MkTy EmptyFC EmptyFC (UN $ Basic n) (IVar EmptyFC enumName)
71+
mkCon n = MkTy EmptyFC (NoFC $ UN $ Basic n) (IVar EmptyFC enumName)
7272
7373
dat : Data
7474
dat = MkData EmptyFC enumName (Just (IType EmptyFC)) [] (map mkCon cons)

src/Doc/Generic4.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ deriveGeneral ns fs = do
246246
, "Record"
247247
, "Clause"
248248
, "Decl"
249+
, "IClaimData"
249250
] [Generic', Eq', Ord']
250251
```
251252

src/Language/Reflection/Pretty.idr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ export
109109
Pretty FC where
110110
prettyPrec _ _ = line "emptyFC"
111111

112+
export
113+
Pretty a => Pretty (WithFC a) where
114+
prettyPrec n x = prettyPrec n x.value
115+
112116
export
113117
Pretty a => Pretty (WithDefault a def') where
114118
prettyPrec p withDef =
@@ -155,10 +159,11 @@ prettyImplITy : Pretty ITy
155159
, "IField"
156160
, "Record"
157161
, "Decl"
162+
, "IClaimData"
158163
] [Pretty]
159164

160165
prettyImplITy = MkPretty $ \p,v => case v of
161-
(MkTy _ _ n ty) => recordH p "mkTy" [("name", n), ("type", ty)]
166+
(MkTy _ n ty) => recordH p "mkTy" [("name", n.value), ("type", ty)]
162167

163168
prettyImplArg = MkPretty $ \p,v =>
164169
conH p "MkArg" [v.count, v.piInfo, v.name, v.type]

src/Language/Reflection/Syntax.idr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ as = IAs EmptyFC EmptyFC UseLeft
474474
||| This is an alias for `MkTyp EmptyFC`.
475475
public export %inline
476476
mkTy : (name : Name) -> (type : TTImp) -> ITy
477-
mkTy = MkTy EmptyFC EmptyFC
477+
mkTy = MkTy EmptyFC . MkFCVal EmptyFC
478478

479479
||| Type declaration of a function.
480480
|||
@@ -488,7 +488,7 @@ claim :
488488
-> (name : Name)
489489
-> (type : TTImp)
490490
-> Decl
491-
claim c v opts n tp = IClaim EmptyFC c v opts (mkTy n tp)
491+
claim c v opts n tp = IClaim $ MkFCVal EmptyFC $ MkIClaimData c v opts (mkTy n tp)
492492

493493
||| `simpleClaim v n t` is an alias for `claim MW v [] (mkTy n t)`
494494
public export %inline

src/Language/Reflection/Types.idr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,3 +667,4 @@ getParamInfo' n = do
667667
export %macro
668668
getParamInfo : Name -> Elab ParamTypeInfo
669669
getParamInfo = getParamInfo'
670+

src/Test/Enum2.idr

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import Language.Reflection.Util
88

99
ex1 : List Decl
1010
ex1 =
11-
[ IClaim
12-
emptyFC
11+
[ IClaim $ NoFC $ MkIClaimData
1312
MW
1413
Private
1514
[]

src/Test/Inspect.idr

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,13 @@ ex9 =
7373

7474
ex10 : List Decl
7575
ex10 =
76-
[ IClaim
77-
emptyFC
76+
[ IClaim $ NoFC $ MkIClaimData
7877
MW
7978
Export
8079
[Inline]
8180
(MkTy
8281
emptyFC
83-
emptyFC
84-
"test"
82+
(NoFC "test")
8583
( MkArg MW ExplicitArg Nothing (primVal (PrT IntType))
8684
.-> primVal (PrT IntType)))
8785
, IDef
@@ -103,10 +101,9 @@ ex11 =
103101
[]
104102
[ MkTy
105103
emptyFC
106-
emptyFC
107-
"A"
104+
(NoFC "A")
108105
( MkArg MW ExplicitArg Nothing (bindVar "t")
109106
.-> var "Foo" .$ bindVar "t")
110-
, MkTy emptyFC emptyFC "B" (var "Foo" .$ bindVar "t")
107+
, MkTy emptyFC (NoFC "B") (var "Foo" .$ bindVar "t")
111108
])
112109
]

0 commit comments

Comments
 (0)