mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-17 13:27:30 +03:00
in update, don't bother typechecking again if we haven't changed the unison file
This commit is contained in:
parent
4ffbc7ee69
commit
011718fb8e
@ -128,19 +128,33 @@ handleUpdate2 = do
|
||||
|
||||
pure (pped, bigUf)
|
||||
|
||||
-- - typecheck it
|
||||
Cli.respond Output.UpdateStartTypechecking
|
||||
parsingEnv <- makeParsingEnv currentPath namesIncludingLibdeps
|
||||
prettyParseTypecheck bigUf pped parsingEnv >>= \case
|
||||
Left prettyUf -> do
|
||||
Cli.Env {isTranscript} <- ask
|
||||
maybePath <- if isTranscript then pure Nothing else Just . fst <$> Cli.expectLatestFile
|
||||
Cli.respond (Output.DisplayDefinitionsString maybePath prettyUf)
|
||||
Cli.respond Output.UpdateTypecheckingFailure
|
||||
Right tuf -> do
|
||||
Cli.respond Output.UpdateTypecheckingSuccess
|
||||
saveTuf (findCtorNames namesExcludingLibdeps ctorNames Nothing) tuf
|
||||
Cli.respond Output.Success
|
||||
-- If the new-unison-file-to-typecheck is the same as old-unison-file-that-we-already-typechecked, then don't bother
|
||||
-- typechecking again.
|
||||
secondTuf <- do
|
||||
let smallUf = UF.discardTypes tuf
|
||||
let noChanges =
|
||||
and
|
||||
[ UF.dataDeclarations smallUf == UF.dataDeclarations bigUf,
|
||||
UF.effectDeclarations smallUf == UF.effectDeclarations bigUf,
|
||||
UF.terms smallUf == UF.terms bigUf, -- no need to sort these, though it wouldn't hurt
|
||||
UF.watches smallUf == UF.watches bigUf
|
||||
]
|
||||
if noChanges
|
||||
then pure tuf
|
||||
else do
|
||||
Cli.respond Output.UpdateStartTypechecking
|
||||
parsingEnv <- makeParsingEnv currentPath namesIncludingLibdeps
|
||||
secondTuf <-
|
||||
prettyParseTypecheck bigUf pped parsingEnv & onLeftM \prettyUf -> do
|
||||
Cli.Env {isTranscript} <- ask
|
||||
maybePath <- if isTranscript then pure Nothing else Just . fst <$> Cli.expectLatestFile
|
||||
Cli.respond (Output.DisplayDefinitionsString maybePath prettyUf)
|
||||
Cli.returnEarly Output.UpdateTypecheckingFailure
|
||||
Cli.respond Output.UpdateTypecheckingSuccess
|
||||
pure secondTuf
|
||||
|
||||
saveTuf (findCtorNames namesExcludingLibdeps ctorNames Nothing) secondTuf
|
||||
Cli.respond Output.Success
|
||||
|
||||
-- TODO: find a better module for this function, as it's used in a couple places
|
||||
prettyParseTypecheck ::
|
||||
|
@ -140,10 +140,6 @@ Expected: `x` is now `2` and `X` is `Two`. UCM says the old definition was also
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
```
|
||||
|
@ -26,10 +26,6 @@ a = "an update"
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
```
|
||||
|
@ -72,10 +72,6 @@ Step 4: I add it and expect to see it
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.trunk> docs x
|
||||
|
@ -230,10 +230,6 @@ master.frobnicate n = n + 1
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> view master.y
|
||||
|
@ -56,10 +56,6 @@ unique type a.T = T1 | T2
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
```
|
||||
@ -151,10 +147,6 @@ b.termInB = 11
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
```
|
||||
@ -247,10 +239,6 @@ b.termInB = 11
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.existing> move.namespace a b
|
||||
|
@ -181,10 +181,6 @@ foo/main> update
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
foo/main> reset /topic
|
||||
|
@ -51,10 +51,6 @@ foo = 200
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> names foo
|
||||
|
@ -88,10 +88,6 @@ x = 3
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.merged> view.patch
|
||||
|
@ -62,10 +62,6 @@ bar = 7
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> view foo bar
|
||||
|
@ -51,10 +51,6 @@ foo = +5
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> view foo
|
||||
|
@ -57,10 +57,6 @@ foo = 6
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> view foo bar
|
||||
|
@ -51,10 +51,6 @@ foo = 6
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> view foo
|
||||
|
@ -64,10 +64,6 @@ After updating `foo` to not be a test, we expect `view` to not render it like a
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> view foo
|
||||
|
@ -46,10 +46,6 @@ unique type Foo
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> view Foo
|
||||
|
@ -43,10 +43,6 @@ unique type Foo = Bar Nat Nat
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> view Foo
|
||||
|
@ -22,10 +22,6 @@ unique type Foo = { bar : Nat }
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> view Foo
|
||||
|
@ -58,10 +58,6 @@ unique type Foo = { bar : Nat, baz : Int }
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> view Foo
|
||||
|
@ -49,10 +49,6 @@ Bug: we leave `Foo.BarAlias` in the namespace with a nameless decl.
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> find.verbose
|
||||
|
@ -46,10 +46,6 @@ unique type Foo
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> view Foo
|
||||
|
@ -35,10 +35,6 @@ Bug: this no-op update should (of course) succeed.
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
```
|
||||
|
@ -49,10 +49,6 @@ Bug: we leave `Stray.BarAlias` in the namespace with a nameless decl.
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> find.verbose
|
||||
|
@ -49,10 +49,6 @@ unique type Foo = { bar : Nat }
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
.> view Foo
|
||||
|
Loading…
Reference in New Issue
Block a user