metaborg / stratego

Apache License 2.0
10 stars 6 forks source link

Adding a head to a list can cause an exception during runtime #22

Open ivardb opened 2 years ago

ivardb commented 2 years ago

Describe the bug If we have an element of a type A and a list of type B such that A and B share an ancestor adding the element to the head of the list causes an exception during runtime.

Project

Versions 0.16.11

To Reproduce See: https://gitlab.ewi.tudelft.nl/CS4200/2021-2022/student-icdebruin/-/commit/c1f2695faffa764a174ee644eb3238fa203e5ab0 This commit fixes the bug by adding a type-signature. Without that fix a runtime exception will occur when example.cpyb is converted to an AST

Observed behaviour Runtime exception

Expected behaviour The lists type should be converted to a list of the shared ancestor

Apanatshka commented 2 years ago

Hmm, I need to think about whether this is a bug or expected behaviour. Subtyping and gradual types is a confusing combination.