Commit 9558e65a authored by Jan Rasmus Tikovsky 's avatar Jan Rasmus Tikovsky
Browse files

Minor bugfix

parent 2a65272a
...@@ -740,19 +740,21 @@ checkVariable v ...@@ -740,19 +740,21 @@ checkVariable v
case qualLookupVar v env of case qualLookupVar v env of
[] -> do report $ errUndefinedVariable v [] -> do report $ errUndefinedVariable v
return $ Variable v return $ Variable v
[Constr _ _] -> return $ Constructor v [Constr _ _] -> return $ Constructor v
[GlobalVar _ _] -> return $ Variable v [GlobalVar _ _] -> return $ Variable v
[LocalVar v' _] -> return $ Variable $ qualify v' [LocalVar v' _] -> return $ Variable $ qualify v'
[RecordLabel _ _] -> return $ Variable v
rs -> do rs -> do
m <- getModuleIdent m <- getModuleIdent
case qualLookupVar (qualQualify m v) env of case qualLookupVar (qualQualify m v) env of
[] -> do report $ errAmbiguousIdent rs v [] -> do report $ errAmbiguousIdent rs v
return $ Variable v return $ Variable v
[Constr _ _] -> return $ Constructor v [Constr _ _] -> return $ Constructor v
[GlobalVar _ _] -> return $ Variable v [GlobalVar _ _] -> return $ Variable v
[LocalVar v' _] -> return $ Variable $ qualify v' [LocalVar v' _] -> return $ Variable $ qualify v'
rs' -> do report $ errAmbiguousIdent rs' v [RecordLabel _ _] -> return $ Variable v
return $ Variable v rs' -> do report $ errAmbiguousIdent rs' v
return $ Variable v
checkRecordExpr :: Position -> QualIdent -> [Field Expression] -> SCM Expression checkRecordExpr :: Position -> QualIdent -> [Field Expression] -> SCM Expression
checkRecordExpr _ c [] = do checkRecordExpr _ c [] = do
......
...@@ -1083,8 +1083,10 @@ sureVarType v tyEnv = case lookupValue v tyEnv of ...@@ -1083,8 +1083,10 @@ sureVarType v tyEnv = case lookupValue v tyEnv of
funType :: ModuleIdent -> QualIdent -> ValueEnv -> TypeScheme funType :: ModuleIdent -> QualIdent -> ValueEnv -> TypeScheme
funType m f tyEnv = case qualLookupValue f tyEnv of funType m f tyEnv = case qualLookupValue f tyEnv of
[Value _ _ sigma] -> sigma [Value _ _ sigma] -> sigma
[Label _ _ sigma] -> sigma
_ -> case qualLookupValue (qualQualify m f) tyEnv of _ -> case qualLookupValue (qualQualify m f) tyEnv of
[Value _ _ sigma] -> sigma [Value _ _ sigma] -> sigma
[Label _ _ sigma] -> sigma
_ -> internalError $ "TypeCheck.funType " ++ show f _ -> internalError $ "TypeCheck.funType " ++ show f
++ ", more precisely " ++ show (unqualify f) ++ ", more precisely " ++ show (unqualify f)
......
...@@ -13,4 +13,8 @@ fun C { l = 42 } = True ...@@ -13,4 +13,8 @@ fun C { l = 42 } = True
fun2 C {} = False fun2 C {} = False
-- update -- update
upd r = r { x = False, l = 0 } upd r = r { x = False, l = 0 }
\ No newline at end of file
-- selection
getL :: R a -> Int
getL r = l r
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment