Skip to content

spec mismatch on where $id appears in a type declarator #2192

@lukewagner

Description

@lukewagner

In a type context (Inside an instance or component type), the definition of exportdecl says to bind an $identifier right after the type token (symmetric to func, component, instance, etc; the rule just says bind-id(<externdesc>) and type is one of the <externdesc>) which suggests that the following component should be valid:

(component
  (import "i" (instance
    (export "foo" (func $foo ...))
    (export "inst" (instance $inst ...))
    (export "R" (type $R (sub resource)))  ;; currently error
  ))
)

Instead the following parses and validates:

(component
  (import "i" (instance
    (export $R "R" (type (sub resource)))  ;; currently ok
  ))
)

It's true that a (non-type-level) export binds an $identifier right after the export, e.g.:

(component
  (type $R (resource (rep i32)))
  (export $R' "R" (type $R))
)

but this is specific to export definitions which both reference and bind an $identifier (see also CM/#341, which proposes to remove it).

Probably we can't just break the second example, but it'd be useful if the first example started to parse/validate to match the spec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions