Skip to content

Commit 7c9abc8

Browse files
committed
Verifier: fix wrong typeOf' behavior
1 parent f6fd6de commit 7c9abc8

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

lib/Verifier.hs

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,57 @@ typeOf' (FuncCall name _ _) = do
7474
matchingBinding <- findMatchingBinding name
7575
-- when (isNothing matchingBinding) $ error $ "Could not find relevant binding for " ++ name
7676
return $ maybe Unknown ttype matchingBinding
77-
typeOf' x = return $ typeOf x
77+
typeOf' (Add a _) = typeOf' a
78+
typeOf' (Sub a _) = typeOf' a
79+
typeOf' (Mul a _) = typeOf' a
80+
typeOf' (Div a _) = typeOf' a
81+
typeOf' (Power a _) = typeOf' a
82+
typeOf' (UnaryMinus x) = typeOf' x
83+
typeOf' (If _ b _) = typeOf' b
84+
typeOf' (Modulo x _) = typeOf' x
85+
typeOf' (ListConcat x _) = typeOf' x
86+
typeOf' (StructAccess s _) = typeOf' s
87+
typeOf' (Pipeline _ b) = typeOf' b
88+
typeOf' (Flexible x) = typeOf' x
89+
typeOf' (Then _ b) = typeOf' b
90+
typeOf' (StrictEval x) = typeOf' x
91+
typeOf' x@ListPattern{} = return $ typeOf x
92+
typeOf' x@BoolLit{} = return $ typeOf x
93+
typeOf' x@IntLit{} = return $ typeOf x
94+
typeOf' x@FloatLit{} = return $ typeOf x
95+
typeOf' x@StringLit{} = return $ typeOf x
96+
typeOf' x@StructLit{} = return $ typeOf x
97+
typeOf' x@DoubleLit{} = return $ typeOf x
98+
typeOf' x@CharLit{} = return $ typeOf x
99+
typeOf' x@Discard{} = return $ typeOf x
100+
typeOf' x@ListLit{} = return $ typeOf x
101+
typeOf' x@ArrayAccess{} = return $ typeOf x
102+
typeOf' x@Not{} = return $ typeOf x
103+
typeOf' x@Eq{} = return $ typeOf x
104+
typeOf' x@Neq{} = return $ typeOf x
105+
typeOf' x@Lt{} = return $ typeOf x
106+
typeOf' x@Gt{} = return $ typeOf x
107+
typeOf' x@Le{} = return $ typeOf x
108+
typeOf' x@Ge{} = return $ typeOf x
109+
typeOf' x@And{} = return $ typeOf x
110+
typeOf' x@Or{} = return $ typeOf x
111+
typeOf' x@DoBlock{} = return $ typeOf x
112+
typeOf' x@FuncDef{} = return $ typeOf x
113+
typeOf' x@FuncDec{} = return $ typeOf x
114+
typeOf' x@Function{} = return $ typeOf x
115+
typeOf' x@ExternDec{} = return $ typeOf x
116+
typeOf' x@Lambda{} = return $ typeOf x
117+
typeOf' x@Cast{} = return $ typeOf x
118+
typeOf' x@TypeLit{} = return $ typeOf x
119+
typeOf' x@Target{} = return $ typeOf x
120+
typeOf' x@Ref{} = return $ typeOf x
121+
typeOf' x@Import{} = return $ typeOf x
122+
typeOf' x@Struct{} = return $ typeOf x
123+
typeOf' x@Trait{} = return $ typeOf x
124+
typeOf' x@Impl{} = return $ typeOf x
125+
typeOf' x@External{} = return $ typeOf x
126+
typeOf' x@Placeholder{} = return $ typeOf x
127+
typeOf' x@Let{} = return $ typeOf x
78128

79129
compareTypes' :: Type -> Type -> [AST.GenericExpr] -> StateT VerifierState IO Bool
80130
compareTypes' (List x) (List y) generics = compareTypes' x y generics

0 commit comments

Comments
 (0)