irken-compiler icon indicating copy to clipboard operation
irken-compiler copied to clipboard

type errors with 'object protocol'.

Open samrushing opened this issue 10 years ago • 1 comments

The type solver is not catching some type errors when using object support (i.e., ob::method syntax). This particular case involved iterating over a map, I accidentally swapped the types of the key and value, and the typer did not catch the error.

samrushing avatar Oct 16 '15 09:10 samrushing

Found a nice repro:

    (define get-dtcon-tag
      'nil label -> (alist/get the-context.variant-labels label "unknown variant label")
      dt variant -> (let ((dtob (alist/get the-context.datatypes dt "no such datatype")))
                      (dtob.get variant)))

Which wanted to be this:

    (define get-dtcon-tag
      'nil label -> (alist/get the-context.variant-labels label "unknown variant label")
      dt variant -> (let ((dtob (alist/get the-context.datatypes dt "no such datatype"))
                          (alt (dtob.get variant)))
                      alt.index))

The type phase did not catch this error.

samrushing avatar Sep 01 '18 03:09 samrushing