SubConcept can specialize a child with an incompatible type

I'm learning MPS and playing around with concept declarations. I've just discovered the ability to have a subConcept specialize a child with a type that is incompatible with it's superclass. This doesn't seem to generate any errors in the language model, but does allow for invalid solution input.

Here's an example:

Concept Foo extends BaseConcept {
child myChild: Foo[1]
}

Concept Bar extends Foo {
child mySpecializedChild: Baz[1] specializes: myChild
}

Concept Baz extends BaseConcept {
}

I am able to create this in my language model, and everything checks out. However, this means that I can then, in my solution create the following, prompted by autocomplete options:

Bar {
myChild: Baz
}

This then triggers the error: "incompatible target concept in role myChild: subconcept of Foo expected, Baz found."

The error makes perfect sense, but this seems like something that should be prevented at the language level, not merely at the solution. Perhaps I'm missing something? Hope this makes sense, thanks!
2 comments
Hi,

this is a flaw in MPS, which, however, we will address only as part of major reorganization of the structure language. The possibility to specialize links may well be found redundant and removed at that point.

Vaclav
0
Ah, ok. Glad it's a known issue.
0

Please sign in to leave a comment.