Skip to content

Heap indexing expressions should be subtypes of intish #110

@ghost

Description

The latter half of section 6.10 of the specification describes the conditions for valid heap indexing expressions. One of them is:

ValidateExpression succeeds for expr with type intish;

which should read

ValidateExpression succeeds for expr with a subtype of intish;

The following module, for example, is correctly accepted by OdinMonkey's validator:

(function(std, ffi, buff) {
  "use asm"
  var H32 = new std.Int32Array(buff)
  function f(x, y) {
    x = x|0
    y = y|0
    H32[x >> 2] = y
  }
  return f
})

Note that the indexing expression x in H32[x >> 2] has type int <: intish.

The specification does not appeal to expression subsumption elsewhere, so this ought to be made explicit as a matter of consistency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions