Repository navigation
A function defined twice is silently the second one - #24
Merged
Merged
Conversation
Neither checker says anything and the later definition wins. Recorded because it cost a real bug an hour ago: spool replaced two insertion sorts with calls to the new builtin, left the old bodies in the same files, and both files kept running the insertion sort. Tests, source gate and CI all passed, because nothing looks at whether a name is defined twice. A redefinition inside one file is almost always an edit that went wrong. There is no conditional compilation in this language, so the cases where somebody means it do not exist, which makes this cheap to diagnose and the false-positive rate zero. Refusing it in the checker is the obvious fix and is not written yet. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Recorded in
docs/BUGS.mdunder Open because it cost a real bug today.twill-lang/spoolreplaced two insertion sorts with calls to the new builtin and left the old bodies in the same files. Both files then defined the function twice, both kept running the insertion sort, and the tests, the source gate and CI all passed — nothing anywhere looks at whether a name is defined twice. The commit said four sorts had been replaced when two had. twill-lang/spool#4 is the correction.A redefinition inside one file is almost always an edit that went wrong. There is no conditional compilation in this language, so the cases where somebody means it do not exist, which makes this cheap to diagnose with a false-positive rate of zero.
This PR only writes it down. Refusing it in the checker is the fix and is not written yet.
🤖 Generated with Claude Code