Merge remote-tracking branch 'origin/trunk' into fix/2133

This commit is contained in:
Paul Chiusano 2021-08-04 12:07:50 -04:00
commit 2d1b85e89f
4 changed files with 55 additions and 6 deletions

View File

@ -1030,11 +1030,15 @@ anfBlock (Match' scrut cas) = do
mdf
AccumEmpty -> pure (sctx <> cx, pure $ TMatch v MatchEmpty)
anfBlock (Let1Named' v b e)
= anfBlock b >>= \(bctx, (d0, cb)) -> bindLocal [v] $ do
(ectx, ce) <- anfBlock e
d <- bindDirection d0
let octx = bctx <> directed [ST1 d v BX cb] <> ectx
pure (octx, ce)
= anfBlock b >>= \case
(bctx, (Direct, TVar u)) -> do
(ectx, ce) <- anfBlock e
pure (bctx <> ectx, ABTN.rename v u <$> ce)
(bctx, (d0, cb)) -> bindLocal [v] $ do
(ectx, ce) <- anfBlock e
d <- bindDirection d0
let octx = bctx <> directed [ST1 d v BX cb] <> ectx
pure (octx, ce)
anfBlock (Apps' f args) = do
(fctx, (d, cf)) <- anfFunc f
(actx, cas) <- anfArgs args

View File

@ -916,7 +916,7 @@ emitLet _ grp _ _ _ ctx (TApp (FPrim p) args)
= fmap (Ins . either emitPOp emitFOp p $ emitArgs grp ctx args)
emitLet rns grp rec d vcs ctx bnd
| Direct <- d
= internalBug $ "unsupported compound direct let" ++ show bnd
= internalBug $ "unsupported compound direct let: " ++ show bnd
| Indirect w <- d
= \esect ->
f <$> emitSection rns grp rec (Block ctx) bnd

View File

@ -0,0 +1,19 @@
```ucm:hide
.> builtins.mergeio
```
```unison
lexicalScopeEx: [Text]
lexicalScopeEx =
parent = "outer"
inner1 = let
child1 = "child1"
inner2 : [Text]
inner2 = let
child2 = "child2"
[parent, child1, child2]
inner2
inner1
```

View File

@ -0,0 +1,26 @@
```unison
lexicalScopeEx: [Text]
lexicalScopeEx =
parent = "outer"
inner1 = let
child1 = "child1"
inner2 : [Text]
inner2 = let
child2 = "child2"
[parent, child1, child2]
inner2
inner1
```
```ucm
I found and typechecked these definitions in scratch.u. If you
do an `add` or `update`, here's how your codebase would
change:
⍟ These new definitions are ok to `add`:
lexicalScopeEx : [Text]
```