type in an overload group were left unchecked

This commit is contained in:
Krasimir Angelov
2026-09-12 10:38:00 +02:00
parent cf90d1280f
commit ae502f37ca
+8 -3
View File
@@ -241,8 +241,13 @@ checkInfo opts cwd sgr sm (c,info) = checkInModule cwd (snd sm) NoLoc empty $ do
checkError (pp "No definition given to the operation") checkError (pp "No definition given to the operation")
update sm c (ResOper pty' pde') update sm c (ResOper pty' pde')
ResOverload os tysts -> chIn NoLoc "overloading" $ do ResOverload os tysts -> do
tysts' <- mapM (uncurry $ flip (\(L loc1 t) (L loc2 ty) -> checkLType gc t ty >>= \(t,ty) -> return (L loc1 t, L loc2 ty))) tysts -- return explicit ones tysts' <- forM tysts $ \(L locty ty, L loct t) -> do -- return explicit ones
(ty,_) <- chIn locty "overload" $
checkLType gc ty typeType
(t,ty) <- chIn loct "overload" $
checkLType gc t ty
return (L locty ty,L loct t)
tysts0 <- lookupOverload gr (fst sm,c) -- check against inherited ones too tysts0 <- lookupOverload gr (fst sm,c) -- check against inherited ones too
tysts1 <- sequence tysts1 <- sequence
[checkLType gc tr (mkFunType args val) | (args,(val,tr)) <- tysts0] [checkLType gc tr (mkFunType args val) | (args,(val,tr)) <- tysts0]
@@ -250,7 +255,7 @@ checkInfo opts cwd sgr sm (c,info) = checkInModule cwd (snd sm) NoLoc empty $ do
--- with value type is only possible if expected type is given --- with value type is only possible if expected type is given
--checkUniq $ --checkUniq $
-- sort [let (xs,t) = typeFormCnc x in t : map (\(b,x,t) -> t) xs | (_,x) <- tysts1] -- sort [let (xs,t) = typeFormCnc x in t : map (\(b,x,t) -> t) xs | (_,x) <- tysts1]
update sm c (ResOverload os [(y,x) | (x,y) <- tysts']) update sm c (ResOverload os tysts')
ResParam (Just (L loc pcs)) _ -> do ResParam (Just (L loc pcs)) _ -> do
(sm,cnt,ts,pcs) <- chIn loc "parameter type" $ (sm,cnt,ts,pcs) <- chIn loc "parameter type" $