Repository navigation
Conversation
nicolas-abril
force-pushed
the
proto/1632-2-uses-point-at-uses
branch
3 times, most recently
from
October 30, 2026 13:36
2f54888 to
c619928
Compare
…rm that uses it again (bendlang#1632)
nicolas-abril
force-pushed
the
proto/1632-2-uses-point-at-uses
branch
from
October 30, 2026 14:51
c619928 to
2db198d
Compare
Collaborator
|
Closing this one: pointing at the second use costs too much code for what it gives. The checker only learns that a value was used twice where two use maps are added together, and at that point it no longer knows where either use was. To point at the second use you have to do one of these:
None of these is small enough, so the error keeps pointing at the binder, as it does on main. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a prototype for proposal 2 of #1632 (a value used twice), in reply to the request to prototype 1–7. It is opened against
bendlang/bendfor review:bend2/bend.tsis human-written per AGENTS.md, so it is not a merge request as it stands. The branch isproto/1632-2-uses-point-at-useson the fork,2db198d8, one commit onmain(9d514f3).The error is reported where the second use is found, while the uses are summed. There is no new pass, no new field, and no span is stored on
Quant; the span comes from the term being checked. The whole change is one check inuses_add(bend.ts+14/−7):The other lines are the seven callers (
App,Min,tele_check,Let×2,Rwt), which now pass the span of the argument / operand / value / body they add.uses_closeis unchanged and still catches the cases the sum doesn't see (aLonevalue used under a+position keepsmain's message, with the caret on the binder). Match arms still join, so one use in each arm is still one use.Your repro:
A pattern field used twice points at the second use too. No extra note is needed, because the field can already take the
+itself:case 1n+(+p):checks onmain.Trade-offs:
Context:block now lists the binder itself (and anything bound after it). Expected outputs gain those lines.tests/io/reuse_across_effect.bendit underlines the wholec <- …statement that uses the value again.Tests: 19 existing expected outputs were regenerated (caret moved and/or
Context:lines added).tests/check/pattern_use_twice.bendpins the pattern case.tests/check/equation_endpoints_dead.bendpins that a mention in a type position (an equation's endpoints) is not counted as a use. Results: repo 54/54, test 1785/1785,tscerrors the same asmain,gates/test.tswall time ~16.5 s.