Closed mbenke closed 1 month ago
Consider functions (see https://github.com/rodrigogribeiro/solcore/blob/specialisation/test/examples/spec/03join.solc)
function just(x) { return Some[x]; } function maybe(n, o) { match o { | None => return n; | Some[x] => return x; }; } function join(mmx) { match mmx { | Some[Some[x]] => return Some[x]; | _ => return None; }; }
They seem to be typed properly
Results: just :: forall a . a -> Option[a] Results: maybe :: forall a . a -> Option[a] -> a Results: join :: forall a . Option[Option[a]] -> Option[a]
...but the types in their arguments seem mismatched
Signature { sigName = just, sigContext = [], sigParams = [ Typed (Id {idName = x, idType = TyVar (TVar j)}) (TyVar (TVar i)) ], sigReturn = Just (TyCon Option [TyVar (TVar j)])}
in the Typed a t the idType a says the type is "j", but type t says "i"
Typed a t
idType a
Similarly for maybe
maybe
Signature { sigName = maybe, sigContext = [], sigParams = [ Typed (Id {idName = n, idType = TyVar (TVar r)}) (TyVar (TVar n)) , Typed (Id {idName = o, idType = TyCon Option [TyVar (TVar r)]}) (TyVar (TVar o)) ], sigReturn = Just (TyVar (TVar r))}
Fixed on last commit in main.
Consider functions (see https://github.com/rodrigogribeiro/solcore/blob/specialisation/test/examples/spec/03join.solc)
They seem to be typed properly
...but the types in their arguments seem mismatched
in the
Typed a t
theidType a
says the type is "j", but type t says "i"Similarly for
maybe