Skip to content

Commit

Permalink
fix type synonyms
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed May 13, 2024
1 parent bfce447 commit 73d855b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@ checkFunctionParameter ::
FunctionParameter ->
Sem r FunctionParameter
checkFunctionParameter FunctionParameter {..} = do
let ty = _paramType
ty' <- checkIsType (getLoc ty) ty
ty <- checkIsType (getLoc _paramType) _paramType
ty' <- strongNormalize ty
when (_paramImplicit == ImplicitInstance) $ do
tab <- ask
checkInstanceParam tab ty'
Expand Down
13 changes: 8 additions & 5 deletions tests/Compilation/positive/test061.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ import Stdlib.Prelude open hiding {Show; mkShow; module Show};
trait
type Show A := mkShow {show : A → String};

Show' : Type -> Type := Show;
Bool' : Type := Bool;

instance
showStringI : Show String := mkShow (show := id);

instance
showBoolI : Show Bool :=
showBoolI : Show' Bool' :=
mkShow@{
show (x : Bool) : String := if x "true" "false"
};
Expand All @@ -21,9 +24,9 @@ showNatI : Show Nat := mkShow (show := natToString);
g : {A : Type} → {{Show A}} → Nat := 5;

instance
showListI {A} {{Show A}} : Show (List A) :=
showListI {A} {{Show' A}} : Show (List A) :=
mkShow@{
show {A} : {{Show A}} → List A → String
show {A} : {{Show' A}} → List A → String
| nil := "nil"
| (h :: t) := Show.show h ++str " :: " ++str show t
};
Expand All @@ -49,7 +52,7 @@ f'3 {A} {{M : Show A}} : A → String := Show.show {{M}};

f'4 {A} {{_ : Show A}} : A → String := Show.show;

f5 {A} {{Show A}} (n : String) (a : A) : String :=
f5 {A} {{Show' A}} (n : String) (a : A) : String :=
n ++str Show.show a;

instance
Expand All @@ -63,7 +66,7 @@ showBoolFunI : Show (Bool → Bool) := mkShow@{
};

instance
showPairI {A B} {{Show A}} {{Show B}} : Show (A × B) :=
showPairI {A B} {{Show A}} {{Show' B}} : Show' (A × B) :=
mkShow λ {(x, y) := Show.show x ++str ", " ++str Show.show y};

trait
Expand Down

0 comments on commit 73d855b

Please sign in to comment.