Bug 466041 - [validation] Undiagnosed bad type
Summary: [validation] Undiagnosed bad type
Status: NEW
Alias: None
Product: OCL
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: OCL Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 507628
  Show dependency tree
 
Reported: 2015-05-01 07:18 EDT by Ed Willink CLA
Modified: 2016-11-16 13:28 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2015-05-01 07:18:44 EDT
A bad type is converted to OclInvalid by the CS2AS. This suppresses the normal editor warning from an unresolved proxy.

Perhaps Pivot.ocl should detect it.
Comment 1 Ed Willink CLA 2015-05-01 14:37:37 EDT
(In reply to Ed Willink from comment #0)
> Perhaps Pivot.ocl should detect it.

A simple 

context TypedElement
inv TypeIsNotInvalid : type <> OclInvalid

causes 38 OCL test failures.

A problem is that e.g. ExpressionInOCL may have a null type when the body has not been parsed to a bodyExpression.

?? null <> OclInvalid should not be invalid
Comment 2 Ed Willink CLA 2015-05-01 14:44:25 EDT
(In reply to Ed Willink from comment #1)
> ?? null <> OclInvalid should not be invalid

A CG bug in the Type special casing.

Once this is fixed there are 9 failures, mostly/all on InvalidLiteralExp that has a legitimate OclInvalid type.

Constraint overriding is unspecified in OCL, so pragmatically we might just dp

context InvalidLiteralExp 
inv TypeIsNotInvalid : type = OclInvalid

to hide the 'bad' inherited constraint. But Eiffel's Design by Contract principles are a good guide to what we could be trying to do:

"Class invariants are inherited, that is, 'the invariants of all the parents of a class apply to the class itself.'"

The invariant will have to be pushed down to where it is unconditionally valid.
Comment 3 Ed Willink CLA 2015-05-02 04:12:54 EDT
(In reply to Ed Willink from comment #0)
> A bad type is converted to OclInvalid by the CS2AS. This suppresses the
> normal editor warning from an unresolved proxy.

This is an inline conversion that hides the proxy and is contrary to the working use of Xtext policy. All proxy access methods must return proxies when unresolved.