diff --git a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs index a6693ebb4b..3f4e20350d 100644 --- a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs +++ b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs @@ -826,7 +826,7 @@ entryToScopedIden name e = do return ScopedIden { _scopedIdenAlias = Just scopedName', - _scopedIdenFinal = helper (e' ^. symbolEntry) + _scopedIdenFinal = e' ^. symbolEntry } registerScopedIden si return si diff --git a/tests/positive/Isabelle/Program.juvix b/tests/positive/Isabelle/Program.juvix index 0d1b313db0..f587068270 100644 --- a/tests/positive/Isabelle/Program.juvix +++ b/tests/positive/Isabelle/Program.juvix @@ -195,3 +195,17 @@ getMessageFromTrigger' {M H} (t : Trigger M H) : Maybe M := message := m })})}) := just m | _ := nothing; + +-- Syntax aliases + +Name : Type := Nat; + +syntax alias T := Name; + +idT (x : T) : T := x; + +t : T := 0; + +type RR := mkRR { + x : T +}; diff --git a/tests/positive/Isabelle/isabelle/Program.thy b/tests/positive/Isabelle/isabelle/Program.thy index 3ef6bb3b09..74b9598250 100644 --- a/tests/positive/Isabelle/isabelle/Program.thy +++ b/tests/positive/Isabelle/isabelle/Program.thy @@ -18,25 +18,25 @@ definition id2 :: "'A \ 'A" where fun add_one :: "nat list \ nat list" where "add_one [] = []" | (* hello! *) - "add_one (x # xs) = ((x + 1) # add_one xs)" + "add_one (x' # xs) = ((x' + 1) # add_one xs)" fun sum :: "nat list \ nat" where "sum [] = 0" | - "sum (x # xs) = (x + sum xs)" + "sum (x' # xs) = (x' + sum xs)" fun f :: "nat \ nat \ nat \ nat" where - "f x y z = ((z + 1) * x + y)" + "f x' y z = ((z + 1) * x' + y)" fun g :: "nat \ nat \ bool" where - "g x y = (if x = f x (N.g y) (M_N.g (M_Main.f y)) then False else True)" + "g x' y = (if x' = f x' (N.g y) (M_N.g (M_Main.f y)) then False else True)" fun inc :: "nat \ nat" where - "inc x = (Suc x)" + "inc x' = (Suc x')" (* dec function *) fun dec :: "nat \ nat" where "dec 0 = 0" | - "dec (Suc x) = x" + "dec (Suc x') = x'" (* dec' function *) fun dec' :: "nat \ nat" where @@ -45,23 +45,23 @@ fun dec' :: "nat \ nat" where (* the zero case *) (* return zero *) (* the suc case *) - "dec' x = - (case x of + "dec' x' = + (case x' of 0 \ 0 | (Suc y) \ y)" fun optmap :: "('A \ 'A) \ 'A option \ 'A option" where "optmap f' None = None" | - "optmap f' (Some x) = (Some (f' x))" + "optmap f' (Some x') = (Some (f' x'))" fun pboth :: "('A \ 'A') \ ('B \ 'B') \ 'A \ 'B \ 'A' \ 'B'" where - "pboth f' g' (x, y) = (f' x, g' y)" + "pboth f' g' (x', y) = (f' x', g' y)" fun bool_fun :: "bool \ bool \ bool \ bool" where - "bool_fun x y z = (x \ (y \ z))" + "bool_fun x' y z = (x' \ (y \ z))" fun bool_fun' :: "bool \ bool \ bool \ bool" where - "bool_fun' x y z = (x \ y \ z)" + "bool_fun' x' y z = (x' \ y \ z)" (* Queues *) text \ @@ -71,7 +71,7 @@ datatype 'A Queue = queue "'A list" "'A list" fun qfst :: "'A Queue \ 'A list" where - "qfst (queue x v') = x" + "qfst (queue x' v') = x'" fun qsnd :: "'A Queue \ 'A list" where "qsnd (queue v' v'0) = v'0" @@ -85,10 +85,10 @@ fun pop_front :: "'A Queue \ 'A Queue" where v' \ q')" fun push_back :: "'A Queue \ 'A \ 'A Queue" where - "push_back q x = + "push_back q x' = (case qfst q of - [] \ queue [x] (qsnd q) | - q' \ queue q' (x # qsnd q))" + [] \ queue [x'] (qsnd q) | + q' \ queue q' (x' # qsnd q))" text \ Checks if the queue is empty @@ -291,11 +291,26 @@ fun getMessageFromTrigger :: "('M, 'H) Trigger \ 'M option" where v'1 \ None)" fun getMessageFromTrigger' :: "('M, 'H) Trigger \ 'M option" where - "getMessageFromTrigger' t = - (case t of + "getMessageFromTrigger' t' = + (case t' of (MessageArrived v') \ (case (EnvelopedMessage.packet v') of (v'0) \ Some (MessagePacket.message v'0)) | v'2 \ None)" +(* Syntax aliases *) +type_synonym Name = nat + +fun idT :: "nat \ Name" where + "idT x' = x'" + +definition t :: Name where + "t = 0" + +record RR = + x :: nat + +fun x :: "RR \ Name" where + "x (| RR.x = x' |) = x'" + end