Skip to content

Commit 8225744

Browse files
committed
Constant local term definition sites working
1 parent 779f2b7 commit 8225744

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

parser-typechecker/src/Unison/Typechecker/Context.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,7 @@ synthesizeWanted (Term.Let1Top' top binding boundVarAnn e) = do
12431243
when (Var.isAction (ABT.variable e)) $
12441244
-- enforce that actions in a block have type ()
12451245
subtype tbinding (DDB.unitType (ABT.annotation binding))
1246+
Debug.debugM Debug.Temp "Let1Top" (ABT.variable e, v', anythingToString boundVarAnn, tbinding)
12461247
appendContext [Ann v' boundVarAnn tbinding]
12471248
(t, w) <- synthesize (ABT.bindInheritAnnotation e (Term.var () v'))
12481249
t <- applyM t

unison-cli/src/Unison/LSP/FileAnalysis.hs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,6 @@ checkFile doc = runMaybeT do
125125
_ -> mempty
126126
& pure
127127

128-
let allVarBindings =
129-
typecheckingNotes
130-
& Foldable.toList
131-
& reverse -- Type notes that come later in typechecking have more information filled in.
132-
& foldMap \case
133-
Result.TypeInfo (Context.VarBinding v loc _typ) -> [(v, loc)]
134-
_ -> mempty
135-
Debug.debugM Debug.Temp "allVarBindings" allVarBindings
136-
137128
let allVarMentions =
138129
typecheckingNotes
139130
& Foldable.toList
@@ -144,16 +135,21 @@ checkFile doc = runMaybeT do
144135
_ -> mempty
145136
Debug.debugM Debug.Temp "allVarMentions" allVarMentions
146137
Debug.debugM Debug.Temp "symbolTypes" symbolTypes
138+
Debug.debugM Debug.Temp "typecheckingNotes" typecheckingNotes
147139
let localBindings :: (IntervalMap Position (Context.Type Symbol Ann)) =
148140
typecheckingNotes
149141
& Foldable.toList
150142
& reverse -- Type notes that come later in typechecking have more information filled in.
151143
& foldMap \case
152-
Result.TypeInfo (Context.VarMention v loc) ->
144+
Result.TypeInfo (Context.VarBinding _v loc typ) -> do
145+
((annToInterval loc) & foldMap \interval -> (IM.singleton interval typ))
146+
Result.TypeInfo (Context.VarMention v loc) -> do
153147
case Map.lookup v symbolTypes of
154-
Just typ -> (annToInterval loc) & foldMap \interval -> (IM.singleton interval typ)
148+
Just typ ->
149+
((annToInterval loc) & foldMap \interval -> (IM.singleton interval typ))
155150
_ -> mempty
156151
_ -> mempty
152+
Debug.debugM Debug.Temp "localBindings" localBindings
157153
pure (localBindings, typecheckingNotes, Just parsedFile, maybeTypecheckedFile)
158154

159155
filePPED <- lift $ ppedForFileHelper parsedFile typecheckedFile

unison-cli/src/Unison/LSP/Queries.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import Unison.ConstructorReference (GConstructorReference (..))
2828
import Unison.ConstructorType qualified as CT
2929
import Unison.DataDeclaration (Decl)
3030
import Unison.DataDeclaration qualified as DD
31+
import Unison.Debug qualified as Debug
3132
import Unison.HashQualified qualified as HQ
3233
import Unison.LSP.Conversions (lspToUPos)
3334
import Unison.LSP.FileAnalysis (getFileSummary, ppedForFile)

0 commit comments

Comments
 (0)