Ellipsis shouldn't introduce anything into scope

This commit is contained in:
Ryan Trinkle 2019-03-09 17:40:23 -05:00
parent 4ee68caa70
commit d8a66c09ab
2 changed files with 10 additions and 8 deletions

View File

@ -341,26 +341,25 @@ buildArgument params arg = do
Nothing -> id
Just n -> M.insert n $ const $
thunk (withScopes scope arg)
loebM (inject $ alignWithKey (assemble scope isVariadic)
loebM (inject $ M.mapMaybe id $ alignWithKey (assemble scope isVariadic)
args (M.fromList s))
where
assemble :: Scopes m t
-> Bool
-> Text
-> These t (Maybe (m v))
-> AttrSet t
-> m t
-> Maybe (AttrSet t -> m t)
assemble scope isVariadic k = \case
That Nothing ->
That Nothing -> Just $
const $ evalError @v $ ErrorCall $
"Missing value for parameter: " ++ show k
That (Just f) -> \args ->
That (Just f) -> Just $ \args ->
thunk $ withScopes scope $ pushScope args f
This x | isVariadic -> const (pure x)
| otherwise ->
This _ | isVariadic -> Nothing
| otherwise -> Just $
const $ evalError @v $ ErrorCall $
"Unexpected parameter: " ++ show k
These x _ -> const (pure x)
These x _ -> Just (const (pure x))
addSourcePositions :: (MonadReader e m, Has e SrcSpan)
=> Transform NExprLocF (m a)

View File

@ -0,0 +1,3 @@
let x = 1;
f = { ... }: x;
in f { x = 2; }