|
1 | | -{-# LANGUAGE RankNTypes, CPP, TupleSections #-} |
| 1 | +{-# LANGUAGE RankNTypes, CPP, TupleSections, LambdaCase #-} |
2 | 2 | module GF.Compile.TypeCheck.ConcreteNew( checkLType, checkLType', inferLType, inferLType' ) where |
3 | 3 |
|
4 | 4 | -- The code here is based on the paper: |
@@ -943,6 +943,10 @@ instantiate scope t (VProd Implicit x ty1 ty2) = do |
943 | 943 | VClosure env ty2 -> eval ((x,tnk):env) ty2 [] |
944 | 944 | ty2 -> return ty2 |
945 | 945 | instantiate scope (App t (ImplArg (Meta i))) ty2 |
| 946 | +instantiate scope t ty@(VMeta thk args) = getRef thk >>= \case |
| 947 | + Evaluated _ v -> instantiate scope t v |
| 948 | + Residuation _ _ (Just v) -> instantiate scope t v |
| 949 | + _ -> return (t,ty) -- We don't have enough information to try any instantiation |
946 | 950 | instantiate scope t ty = do |
947 | 951 | return (t,ty) |
948 | 952 |
|
@@ -1121,9 +1125,10 @@ getMetaVars sc_tys = foldM (\acc (scope,ty) -> go ty acc) [] sc_tys |
1121 | 1125 | | m `elem` acc = return acc |
1122 | 1126 | | otherwise = do res <- getRef m |
1123 | 1127 | case res of |
1124 | | - Evaluated _ v -> go v acc |
1125 | | - Residuation _ _ Nothing -> foldM follow (m:acc) args |
1126 | | - _ -> return acc |
| 1128 | + Evaluated _ v -> go v acc |
| 1129 | + Residuation _ _ Nothing -> foldM follow (m:acc) args |
| 1130 | + Residuation _ _ (Just v) -> go v acc |
| 1131 | + _ -> return acc |
1127 | 1132 | go (VApp f args) acc = foldM follow acc args |
1128 | 1133 | go v acc = unimplemented ("go "++showValue v) |
1129 | 1134 |
|
|
0 commit comments