rhombus-prototype icon indicating copy to clipboard operation
rhombus-prototype copied to clipboard

`syntax_class` fields have `Syntax` static information, even when they aren't syntax

Open distractedlambda opened this issue 10 months ago • 0 comments

Consider this code:

#lang rhombus/static

syntax_class Foo:
  kind: ~term
  fields: value
| '$(stx :: Number)':
    field value = stx.unwrap()

def '$(foo :: Foo)' = '42'
foo.value.unwrap()

I would expect the final line to fail statically, since there should not be a known unwrap() method on foo.value; however, this program compiles in static mode. It fails at runtime on the last line, but not when actually matching against the syntax class.

distractedlambda avatar May 05 '25 20:05 distractedlambda