Ampersand icon indicating copy to clipboard operation
Ampersand copied to clipboard

The type system treats ENFORCE and RULE differently.

Open stefjoosten opened this issue 1 year ago • 5 comments

What happened

I am trying to compile the following program:

CONTEXT "Issue1397"

CLASSIFY Application ISA MaintainedItem

RELATION deployed[MaintainedItem*Platform]
RELATION loaded[Application*Platform]

ENFORCE loaded >: deployed

ENDCONTEXT

This produces an error message:

% ampersand check Issue1397.adl
Issue1397.adl:8:1 error:
  Type error, cannot match:
    the concept MaintainedItem (Src of deployed [MaintainedItem*Platform])
    and concept Application (Src of RELATION loaded [Application*Platform]  )
ExitFailure 10

The following script contains the workaround:

CONTEXT "Issue1397"

CLASSIFY Application ISA MaintainedItem

RELATION deployed[MaintainedItem*Platform]
RELATION loaded[Application*Platform]

ENFORCE loaded >: I[Application];deployed

ENDCONTEXT

This compiles flawlessly.

What I expected

I expected that the statement

ENFORCE loaded >: deployed

would be type checked identically to:

RULE loaded >: deployed

Version of ampersand that was used

Ampersand-v4.7.1

stefjoosten avatar Mar 10 '23 08:03 stefjoosten