Ellipsis shouldn't introduce anything into scope
This commit is contained in:
parent
4ee68caa70
commit
d8a66c09ab
|
@ -341,26 +341,25 @@ buildArgument params arg = do
|
||||||
Nothing -> id
|
Nothing -> id
|
||||||
Just n -> M.insert n $ const $
|
Just n -> M.insert n $ const $
|
||||||
thunk (withScopes scope arg)
|
thunk (withScopes scope arg)
|
||||||
loebM (inject $ alignWithKey (assemble scope isVariadic)
|
loebM (inject $ M.mapMaybe id $ alignWithKey (assemble scope isVariadic)
|
||||||
args (M.fromList s))
|
args (M.fromList s))
|
||||||
where
|
where
|
||||||
assemble :: Scopes m t
|
assemble :: Scopes m t
|
||||||
-> Bool
|
-> Bool
|
||||||
-> Text
|
-> Text
|
||||||
-> These t (Maybe (m v))
|
-> These t (Maybe (m v))
|
||||||
-> AttrSet t
|
-> Maybe (AttrSet t -> m t)
|
||||||
-> m t
|
|
||||||
assemble scope isVariadic k = \case
|
assemble scope isVariadic k = \case
|
||||||
That Nothing ->
|
That Nothing -> Just $
|
||||||
const $ evalError @v $ ErrorCall $
|
const $ evalError @v $ ErrorCall $
|
||||||
"Missing value for parameter: " ++ show k
|
"Missing value for parameter: " ++ show k
|
||||||
That (Just f) -> \args ->
|
That (Just f) -> Just $ \args ->
|
||||||
thunk $ withScopes scope $ pushScope args f
|
thunk $ withScopes scope $ pushScope args f
|
||||||
This x | isVariadic -> const (pure x)
|
This _ | isVariadic -> Nothing
|
||||||
| otherwise ->
|
| otherwise -> Just $
|
||||||
const $ evalError @v $ ErrorCall $
|
const $ evalError @v $ ErrorCall $
|
||||||
"Unexpected parameter: " ++ show k
|
"Unexpected parameter: " ++ show k
|
||||||
These x _ -> const (pure x)
|
These x _ -> Just (const (pure x))
|
||||||
|
|
||||||
addSourcePositions :: (MonadReader e m, Has e SrcSpan)
|
addSourcePositions :: (MonadReader e m, Has e SrcSpan)
|
||||||
=> Transform NExprLocF (m a)
|
=> Transform NExprLocF (m a)
|
||||||
|
|
3
tests/eval-compare/ellipsis.nix
Normal file
3
tests/eval-compare/ellipsis.nix
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
let x = 1;
|
||||||
|
f = { ... }: x;
|
||||||
|
in f { x = 2; }
|
Loading…
Reference in a new issue