pyret-lang icon indicating copy to clipboard operation
pyret-lang copied to clipboard

internal error on type check + tables

Open shriram opened this issue 3 years ago • 1 comments

This program runs fine without type-checking, but with it it produces an internal error (as opposed to halting gracefully):


include reactors
include chart

data Pt1: pt1(x :: Number) end
data Pt2: pt2(x :: Number, y :: Number) end
data PtAcc: ptAcc(x :: Number, y :: Number, dy :: Number) end

UFO = scale(0.5, image-url("https://cs.brown.edu/~sk/tmp/ufo.png"))
BG = image-url("https://cs.brown.edu/~sk/tmp/uluru.jpg")

fun move(p :: PtAcc) -> PtAcc:
  ptAcc(p.x + 7, p.y + p.dy, p.dy + 1)
end


check:
  move(ptAcc(0, 25, 6)) is ptAcc(7, 31, 7)
  move(ptAcc(10, 47, 6)) is ptAcc(17, 53, 7)
end

fun show(p :: PtAcc) -> Image:
  place-image(UFO, p.x, p.y, BG)
end

r = reactor:
  init: ptAcc(0, 0, 1),
  on-tick: move,
  to-draw: show
end

t = interact-trace(r)

extend t using state:
  x: state.x,
  y: state.y,
end

The problem is entirely with the extend; until then everything works fine.

shriram avatar Oct 04 '22 23:10 shriram

This could be related to #1422?

shriram avatar Oct 04 '22 23:10 shriram