Open jpolitz opened 9 months ago
A pretty specific type is synthed (https://github.com/brownplt/pyret-lang/blob/f1103c90388a6de3d3468ea48e67bf527f568d36/src/arr/compiler/type-check.arr#L1568), so the issue must be that in constraint solving the related error just gets called “an object type” – harder to track down; that string constant appears in a few places.
Isn't it just failing on "T isn't an object", and never getting to the field-level constraints?
Right, I think that's what I was saying – in constraint solving, it fails on “is type variable T
an object type” and gives an error with that constant string.
One idea is to, when we see “S
is not object” (for any type S
), we search the constraint set for field constraints and report those.
That or augment whatever obj-exists
is with more information to report in constraints, even up to something that says, effectively “This one was created as a constraint for lessthan” and use that to augment the error on failure.
With TC on yields: The type checker rejected your program because it found a T but it expected a an object type.
I think we could do better here, and make the type that's synthesized have a little more explanation than “an object type”.