Repository navigation
Conversation
A non-unit in unit position was reported by its Go syntax-tree type (`not a measurement unit expression: *ast.LiteralInteger`). Both readers of a unit expression now describe it as written: `the number 2`. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…n-error-names-expression
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Contributor
QA: PASSTested head Recording (CLI, validate, REPL, then VS Code on both builds): What passed
Notes (not failures)
Hosted CIThe first run on this head did no testing: every job was cancelled and the Not run
|
This branch has not been deployed
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.
What and why
An expression in unit position that is not a unit was reported by its Go syntax-tree type.
5 [2]now names the expression as the model wrote it.Before (
develop):After (this branch):
Root cause: the fall-through of both readers of a unit expression,
UnitTermOfExpr(units.go) andUnitProductOfExprBy(unit_product.go), formatted the node with%T. Both now call one helper,describeNonUnitExpr, so the two cannot drift.2,2.5*ast.LiteralInteger,*ast.LiteralRealthe number 2,the number 2.5"m"*ast.LiteralStringthe string "m"true*ast.LiteralBoolthe Boolean truenull*ast.NullExprnull**ast.LiteralInfinitythe unbounded value *f(1)*ast.InvocationExpran invocation of fnew A()*ast.ConstructorExpra constructor of A(1, 2)*ast.SequenceExpra sequencea.b*ast.FeatureChainExpran expression that names no unitThe error still wraps
ErrUnitExpr, soerrors.Iscallers are unaffected, and the accepted forms (5 [1], unit names, products, quotients, powers) are untouched.How it was verified
Try it:
make build-sysml && bin/sysml -e '5 [2]'TestUnitExprErrorNamesTheExpression(new,internal/semantic/semantics/units_test.go) checks the message from both readers for each literal kind, an invocation, a sequence and a non-unit inside a product (m*2). It failed first ondevelop's code:and passes with the fix.
The CLI output above is from the binary built at this head; the rows of the table were each run the same way.
At this head:
gofmt -l .(empty),go build ./...andgo vet ./...in the root andtoolsmodules,make lint,python3 scripts/changelog.py check,python3 scripts/check-doc-ids.py, andgo test -count=1on./tests/hygiene,./internal/semantic/semantics,./tests/semantics/...,./internal/frontend/repl,./cmd/sysmland./client/opensysml/....Before merging
develop:go test -raceon./internal/semantic/semantics, andgo test -count=1on./internal/semantic/...,./internal/exec/runtime,./internal/frontend/engine,./internal/frontend/protoconvand./internal/frontend/symbolfacts.No test, golden or document in the tree pinned the old text.
Not run locally: the full
make test(race over every package) and thetoolsmodule test suite.Checklist
make testandmake lintpass locally (make lintpasses;make testwas run only for the packages listed above)changes/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (none moved)F4,K5) in the body, docs, or changelog🟢 Devin Review found nothing to fix · View findings · Follow Devin's work