Skip to content

Commit

Permalink
set namekind
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Aug 24, 2023
1 parent 23a398e commit 0844492
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/Juvix/Compiler/Concrete/Print/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ instance SingI t => PrettyPrint (ModuleRef'' 'S.NotConcrete t) where
instance PrettyPrint (ModuleRef'' 'S.Concrete t) where
ppCode m = ppCode (m ^. moduleRefName)

-- FIXME this is wrong
instance PrettyPrint ScopedIden where
ppCode = ppCode . (^. scopedIden)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,10 @@ entryToScopedIden ::
PreSymbolEntry ->
Sem r ScopedIden
entryToScopedIden name e = do
let scopedName :: S.Name
scopedName = set S.nameConcrete name (e ^. preSymbolName)
let helper :: S.Name' x -> S.Name
helper = set S.nameConcrete name
scopedName :: S.Name
scopedName = helper (e ^. preSymbolName)
si <- case e of
PreSymbolFinal {} ->
return
Expand All @@ -558,10 +560,10 @@ entryToScopedIden name e = do
e' <- normalizePreSymbolEntry e
return
ScopedIden
{ _scopedIdenAlias = Just scopedName,
_scopedIden = set S.nameConcrete name (e' ^. symbolEntry)
{ _scopedIdenAlias = Just (set S.nameKind (getNameKind e') scopedName),
_scopedIden = helper (e' ^. symbolEntry)
}
registerName scopedName
registerName (si ^. scopedIdenName)
return si

-- | We gather all symbols which have been defined or marked to be public in the given scope.
Expand Down
18 changes: 10 additions & 8 deletions tests/positive/Alias.juvix
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
module Alias;

module M;
axiom T : Type; -- line 4
syntax alias A := T; -- line 5
end;
syntax alias A := M.T; -- line 7
open M;
axiom K : A; -- line 9
syntax alias Boolean := Bool;
syntax alias ⊥ := false;
syntax alias ⊤ := true;

end;
type Bool :=
| false
| true;

not : Boolean -> Boolean
| ⊥ := ⊤
| ⊤ := ⊥;

0 comments on commit 0844492

Please sign in to comment.