Skip to content

Read nd and or as the operators they stand for - #866

Merged
onatozmenn merged 1 commit into
mainfrom
the-word-for-the-operator
Aug 2, 2026
Merged

onatozmenn merged 1 commit into
mainfrom
the-word-for-the-operator

Conversation

@onatozmenn

Copy link
Copy Markdown
Collaborator

Closes #865.

A where clause holding and stopped at the word, answered with the block
that did not follow it, and then with a type error about a body the parser
never reached. The resolver has had the right answer since #213 and never got
to give it: a bare name is only an expression where a statement can start, and
a contract clause is not one. Counted across the eighteen recorded model runs,
the word reached the parser seventeen times and the resolver zero.

The word is now read in the operator's position, with the operator's
precedence, so n > 0 and n < 10 or n == 20 parses to the tree the symbols
would have given. That is the part worth arguing about: reporting and stopping
would leave the same cascade, and reporting and dropping would leave a clause
that says less than the one that was written. The repair is a word for a
symbol with nothing else in it, so it is applied rather than offered.

Before and after on the program that found it:

error[DEED2001]: expected `{` while parsing a block, found identifier `and`
error[DEED4001]: expected `Int`, found `()`
error[DEED2020]: this language writes that operator `&&`
  --> twice.deed:4:35
   |
 4 |   where n >= -4611686018427387904 and n <= 4611686018427387903
   |                                   ^^^ write `&&`

deed fix writes it and the file then checks clean.

not is a different shape and is left where it is: it goes in front of a value
rather than between two, so it is still an expression the resolver sees. The
resolver test now says which half is whose.

Break checked: giving and the wrong BinaryOp fails the tree test by name.

Investigated with AI assistance.

A `where` clause holding `and` stopped at the word and answered with the
block that did not follow it, then with a type error about a body the parser
never reached. The resolver has had the right answer since #213 and never got
to give it: a bare name is only an expression where a statement can start, and
a contract clause is not one. Across the eighteen recorded model runs the word
reached the parser seventeen times and the resolver zero.

DEED2020 now. The word is read in the operator's position, with the operator's
precedence, so the clause is the one that was written and the fix is a word for
a symbol. `not` goes in front of a value rather than between two and still
reaches the resolver.
@onatozmenn
onatozmenn merged commit 0e4f521 into main Aug 2, 2026
5 checks passed
@onatozmenn
onatozmenn deleted the the-word-for-the-operator branch August 2, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nd in a where clause is answered with a missing brace

1 participant