Skip to content

A statement compiled to a number throws InvalidProtocolProvided #2224

Closed

Description

@Rafael-SOWNet

In the LINQ compiler, a statement asked for as a number throws InvalidProtocolProvided. That exception says the caller's protocol is wrong, and no protocol was passed.

2.6.0 and master 007a362
"x > 1".ToEntity().Compile<double, double>("x") throws InvalidProtocolProvided: NaN conversion not implemented for System.Boolean
"x > 1".ToEntity().Compile<Complex, Complex>("x") the same, measured on master
"x > 1".ToEntity().Compile<double, bool>("x")(2) True
"x > 1".ToEntity().Compile("x").Call(2) (1, 0), FastExpression's truth value

There are two consistent answers:

  • Compile the statement to its truth value as a number, 1, 0 or NaN, as FastExpression does and as iverson already does.
  • Refuse with UncompilableNodeException, the exception documented for a form the compiler does not have.

The first matches FastExpression, which returns a number for every expression.

CrashCheck counts the exception as a refusal. With #2223, two of its generated cases, x in ZZ and x divides 2, compile far enough to reach this conversion and move from "returned" to "declined".

Part of #2195.

🤖 Generated with Claude Code

Activity

  1. added this to the 2.7.0 milestone on Oct 30, 2026
  2. moved this from Todo to In Progress in AngouriMathon Oct 30, 2026
  3. moved this from In Progress to Done in AngouriMathon Oct 30, 2026
  4. added a commit that references this issue on Nov 4, 2026
    595f523
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions