Skip to content

Commit

Permalink
Merge cp/project-root
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Jul 11, 2024
2 parents d480b3a + 670b086 commit 174f7fa
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 136 deletions.
9 changes: 1 addition & 8 deletions parser-typechecker/src/Unison/Codebase/Branch/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,7 @@ import Unison.Name (Name)
import Unison.Name qualified as Name
import Unison.NameSegment (NameSegment)
import Unison.NameSegment qualified as NameSegment
import Unison.Names (Names (Names))
import Unison.Prelude hiding (empty)
import Unison.PrettyPrintEnv.Names qualified as PPE
import Unison.PrettyPrintEnvDecl (PrettyPrintEnvDecl)
import Unison.PrettyPrintEnvDecl qualified as PPED
import Unison.PrettyPrintEnvDecl.Names qualified as PPED
import Unison.Reference (Reference, TypeReference)
import Unison.Referent (Referent)
import Unison.Util.Monoid qualified as Monoid
Expand Down Expand Up @@ -187,9 +182,7 @@ branch0 terms types children edits =
_deepTerms = R.empty,
_deepTypes = R.empty,
_deepPaths = Set.empty,
_deepEdits = Map.empty,
_names = mempty,
_pped = PPED.empty
_deepEdits = Map.empty
}
& deriveDeepTerms
& deriveDeepTypes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ newBranchCache = do
cache <- readTVarIO var
case Map.lookup ch cache of
Nothing -> pure Nothing
Just weakRef -> do
deRefWeak weakRef
Just weakRef -> deRefWeak weakRef

insertCachedBranch' :: TVar (Map V2.CausalHash (Weak (V1.Branch.Branch Sqlite.Transaction))) -> V2.CausalHash -> (V1.Branch.Branch Sqlite.Transaction) -> Sqlite.Transaction ()
insertCachedBranch' var ch b = Sqlite.unsafeIO do
Expand Down
8 changes: 0 additions & 8 deletions parser-typechecker/src/Unison/FileParsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,6 @@ computeTypecheckingEnvironment shouldUseTndr ambientAbilities typeLookupf uf =
ShouldUseTndr'Yes parsingEnv -> do
let preexistingNames = Parser.names parsingEnv
tm = UF.typecheckingTerm uf
-- possibleDeps =
-- [ (name, shortname, r)
-- | (name, r) <- Rel.toList (Names.terms preexistingNames),
-- v <- Set.toList (Term.freeVars tm),
-- let shortname = Name.unsafeParseVar v,
-- name `Name.endsWithReverseSegments` List.NonEmpty.toList (Name.reverseSegments shortname)
-- ]

let possibleDeps = findMatchingTermSuffixes (Set.map Name.unsafeParseVar $ Term.freeVars tm) preexistingNames
let possibleRefs = Referent.toReference . view _3 <$> possibleDeps
tl <- fmap (UF.declsToTypeLookup uf <>) (typeLookupf (UF.dependencies uf <> Set.fromList possibleRefs))
Expand Down
2 changes: 1 addition & 1 deletion unison-cli/src/Unison/Cli/PrettyPrintUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Unison.PrettyPrintEnvDecl qualified as PPE hiding (biasTo)
import Unison.PrettyPrintEnvDecl qualified as PPED
import Unison.PrettyPrintEnvDecl.Names qualified as PPED

-- -- | Builds a pretty print env decl from a names object.
-- | Builds a pretty print env decl from a names object.
prettyPrintEnvDeclFromNames :: Names -> Cli PPE.PrettyPrintEnvDecl
prettyPrintEnvDeclFromNames ns =
Cli.runTransaction Codebase.hashLength <&> \hashLen ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ diffHelper before after =
Cli.Env {codebase} <- ask
hqLength <- Cli.runTransaction Codebase.hashLength
diff <- liftIO (BranchDiff.diff0 before after)
names <- Cli.currentNames
names <- Cli.currentNames <&> \currentNames -> currentNames <> Branch.toNames before <> Branch.toNames after
pped <- Cli.prettyPrintEnvDeclFromNames names
let suffixifiedPPE = PPED.suffixifiedPPE pped
fmap (suffixifiedPPE,) do
Expand Down
4 changes: 2 additions & 2 deletions unison-src/transcripts/delete.output.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ scratch/main> delete.verbose Foo Foo.Foo incrementFoo
Removed definitions:
1. structural type Foo
2. Foo.Foo : Nat -> #68k40ra7l7
3. incrementFoo : #68k40ra7l7 -> Nat
2. Foo.Foo : Nat -> Foo
3. incrementFoo : Foo -> Nat
Tip: You can use `undo` or use a hash from `branch.reflog` to
undo this change.
Expand Down
11 changes: 6 additions & 5 deletions unison-src/transcripts/diff-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ scratch/b1> builtins.merge lib.builtins
scratch/b2> builtins.merge lib.builtins
scratch/nsx> builtins.merge lib.builtins
scratch/main> builtins.merge lib.builtins
scratch/ns1> builtins.merge lib.builtins
```

```unison:hide
Expand Down Expand Up @@ -79,15 +80,15 @@ scratch/ns1> delete.term junk

```unison:hide
fromJust = 99
b = "oog"
b = 999999999
d = 4
e = 5
f = 6
unique type Y a b = Y a b
```

```ucm
scratch/ns2> update.old
scratch/ns2> update
scratch/main> diff.namespace /ns1: /ns2:
scratch/ns2> alias.term d d'
scratch/ns2> alias.type A A'
Expand All @@ -104,7 +105,7 @@ scratch/main> diff.namespace /ns3: /ns2:
bdependent = "banana"
```
```ucm
scratch/ns3> update.old
scratch/ns3> update
scratch/main> diff.namespace /ns2: /ns3:
```

Expand Down Expand Up @@ -132,15 +133,15 @@ a = 444
```

```ucm
scratch/nsy> update.old
scratch/nsy> update
```

```unison:hide
a = 555
```

```ucm
scratch/nsz> update.old
scratch/nsz> update
scratch/nsy> branch /nsw
scratch/nsw> debug.alias.term.force .forconflicts .a
scratch/nsw> debug.alias.term.force .forconflicts .b
Expand Down
Loading

0 comments on commit 174f7fa

Please sign in to comment.