Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing consistency checks for connection instances #582

Closed
lwrage opened this issue May 1, 2015 · 26 comments · Fixed by #2354
Closed

Missing consistency checks for connection instances #582

lwrage opened this issue May 1, 2015 · 26 comments · Fixed by #2354

Comments

@lwrage
Copy link
Contributor

lwrage commented May 1, 2015

For AADLv1 there was a consistency check for semantic connections during instantiation. These checks need to be updated for AADLv2.

@lwrage lwrage self-assigned this May 1, 2015
@lwrage lwrage added this to the 2015.06 milestone May 1, 2015
@lwrage lwrage modified the milestones: 2015.08, 2015.06 Jun 25, 2015
@lwrage lwrage removed this from the 2015.08 milestone Aug 11, 2015
@lwrage lwrage removed their assignment Sep 10, 2018
@lwrage
Copy link
Contributor Author

lwrage commented Dec 4, 2019

Check would detect that connection ends are refined in a way that makes the connection instance invalid.

@lwrage lwrage added this to the 2.8.0 milestone Apr 13, 2020
@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented Apr 16, 2020

  • Check what's in CheckInstanceSemanticsSwitch
  • Consider refinement of abstract features; Consider refinement of ports with classifiers
    • Refinement can make vague things that were legal into specific things that are not legal

Put new checks in ValidateConnectionsSwitch

(I looked through the history of InstantiateModel, but I didn't see any big blocks of commented out code.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented Apr 16, 2020

Not sure that any of the checks in CheckInstanceSemanticsSwitch make sense to bring back. They are from my very strict interpretation of the "complete system" rules from way back when.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 5, 2020

Here I have a test where I declare a connection from one data port to the another. As initially declared in the scope of the connection, the data ports do not have data classifiers associated with them.

I then make a series of sub-implementations where the data ports are refined to have data classifiers. I cover all four possibilities:

  1. no type -> no type
  2. type -> no type
  3. no type -> type
  4. type -> type

I also declare initially 2 pairs of connections, with and without data classifier, and connect them in the same manner. I am interested in comparing the error reporting behavior of these cases against the refinement cases.

package TestDataPortClassifier
public
	Data D
	end D;
	
	system SrcSys
		features
			f0: out data port;
			
			f_type: out data port D;
			f_notype: out data port;
	end SrcSys;
	
	system SrcSys1 extends SrcSys
		features
			f0: refined to out data port D;
	end SrcSys1;
	
	system DestSys
		features
			f0: in data port;
			
			f_type: in data port D;
			f_notype: in data port;
	end DestSys;
	
	system DestSys1 extends DestSys
		features
			f0: refined to in data port D;
	end DestSys1;
	
	system Top
	end Top;
	
	system implementation Top.notype_to_notype
		subcomponents
			srcSys: system SrcSys;
			destSys: system DestSys;
		connections
			c0: port srcSys.f0 -> destSys.f0;  -- (no type) -> (no type)
			
			type_to_type: port srcSys.f_type -> destSys.f_type; -- type -> type
			type_to_notype: port srcSys.f_type -> destSys.f_notype; -- type to (no type)
			notype_to_type: port srcSys.f_notype -> destSys.f_type; -- (no type) -> type
			notype_to_notype: port srcSys.f_notype -> destSys.f_notype; -- (no type) -> (no type)
		properties
			Classifier_Substitution_Rule => Type_Extension;
	end Top.notype_to_notype;
	
	system implementation Top.type_to_type extends Top.notype_to_notype
		-- now we have have c0 as type -> type
		subcomponents
			srcSys: refined to system SrcSys1;
			destSys: refined to system DestSys1;
	end Top.type_to_type;
	
	system implementation Top.type_to_notype extends Top.notype_to_notype
		-- now we have have c0 as type -> (no type)
		subcomponents
			srcSys: refined to system SrcSys1;
	end Top.type_to_notype;
	
	system implementation Top.notype_to_type extends Top.notype_to_notype
		-- now we have have c0 as (no type) -> type
		subcomponents
			destSys: refined to system DestSys1;
	end Top.notype_to_type;
end TestDataPortClassifier;

I would expect some kind of error/warning on the connections type_to_type, etc. in Top.notype_to_notype. The question is what happens to the connection c0 and what happens when connections are instantiated?

In the declarative model, there are 2 warnings

  • One on destSys.f_notype in the connection type_to_notype: "Expected feature 'f_notype' to have classifier 'Test::D'"
  • One on srcSys.f_notype in the connection notype_to_type: "Expected feature 'f_notype' to have classifier 'Test::D'"

There are no errors or warnings on the instantiated systems. This seems wrong. There should be a some kind of message on the following items:

  • Connection instance srcSys.f_notype -> destSys.f_type in all 4 instance models
  • Connection instance srcSys.f_type -> destSys.f_notype in all 4 instance models
  • Connection instance srcSys.f0 -> destSys.f0 in Top.notype_to_type
  • Connection instance srcSys.f0 -> destSys.f0 in Top.type_to_notype

Not sure if this should be an error or a warning.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 6, 2020

Similarly I have a test for abstract features that start off with no direction and then get refined to have directions.

package TestAbstractDirection
public
	Data D
	end D;
	
	system SrcSys
		features
			f0: feature;
			
			out_feature: out feature;
			in_feature: in feature;
	end SrcSys;
	
	system SrcSysIn extends SrcSys
		features
			f0: refined to in feature;
	end SrcSysIn;
	
	system SrcSysOut extends SrcSys
		features
			f0: refined to out feature;
	end SrcSysOut;
	
	system DestSys
		features
			f0: feature;
			
			out_feature: out feature;
			in_feature: in feature;
	end DestSys;
	
	system DestSysIn extends DestSys
		features
			f0: refined to in feature;
	end DestSysIn;
	
	system DestSysOut extends DestSys
		features
			f0: refined to out feature;
	end DestSysOut;
	
	system Top
	end Top;
	
	system implementation Top.i0
		subcomponents
			srcSys: system SrcSys;
			destSys: system DestSys;
		connections
			c0: feature srcSys.f0 -> destSys.f0;
			
			out_to_out: feature srcSys.out_feature -> destSys.out_feature;
			out_to_in: feature srcSys.out_feature -> destSys.in_feature;
			in_to_out: feature srcSys.in_feature -> destSys.out_feature;
			in_to_in: feature srcSys.in_feature -> destSys.in_feature;
		properties
			Classifier_Substitution_Rule => Type_Extension;
	end Top.i0;
	
	system implementation Top.out_to_out extends Top.i0
		subcomponents
			srcSys: refined to system SrcSysOut;
			destSys: refined to system DestSysOut;
	end Top.out_to_out;
	
	system implementation Top.out_to_in extends Top.i0
		subcomponents
			srcSys: refined to system SrcSysOut;
			destSys: refined to system DestSysIn;
	end Top.out_to_in;
	
	system implementation Top.in_to_out extends Top.i0
		subcomponents
			srcSys: refined to system SrcSysIn;
			destSys: refined to system DestSysOut;
	end Top.in_to_out;
	
	system implementation Top.in_to_in extends Top.i0
		subcomponents
			srcSys: refined to system SrcSysIn;
			destSys: refined to system DestSysIn;
	end Top.in_to_in;
end TestAbstractDirection;

Here we would like some kind of warning/error for all connections that are not from in to out. Connection c0 is initially on two directionless connections. We have additional connections testing all four combinations explicitly as reference points for what should happen with c0.

On the declarative model there are errors on connections out_to_out, in_to_out, and in_to_in: "Source must be outgoing and destination incoming." This is good.

On the instance models, the connection instance is only created if both endpoints are directionless, or if the direction is out to in. This is also good. But we only have error messages for the case of out to out, which is strange.

Obviously we would like to have error messages in the other two (in to in and in to out) cases.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 6, 2020

Also try subprogram/subprogram group/bus/data access features because the data classifier can be refined for these as well.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 6, 2020

Here I have a similar test for data access features where the data type can be introduced by refinement. It is a little more complicated in that there is also a data subcomponent that is refined because data subcomponents can be connected to requires data access features.

package TestDataAccessClassifier
public
	Data D
	end D;
	
	system DataProvider
		features
			f0: provides data access;
			
			f_type: provides data access D;
			f_notype: provides data access;
	end DataProvider;
	
	system DataProvider1 extends DataProvider
		features
			f0: refined to provides data access D;
	end DataProvider1;
	
	system DataConsumer
		features
			f0: requires data access;
			
			f_type: requires data access D;
			f_notype: requires data access;
	end DataConsumer;
	
	system DataConsumer1 extends DataConsumer
		features
			f0: refined to requires data access D;
	end DataConsumer1;
	
	system Top
	end Top;
	
	system implementation Top.notype_to_notype
		subcomponents
			srcSys: system DataProvider;
			destSys: system DataConsumer;
			
			myData: data;
			
			myDataType: data D;
			myDataNoType: data;
		connections
			c0: data access srcSys.f0 -> destSys.f0;  -- (no type) -> (no type)
			c1: data access myData -> destSys.f0;
			
			type_to_type1: data access srcSys.f_type -> destSys.f_type; -- type -> type
			type_to_notype1: data access srcSys.f_type -> destSys.f_notype; -- type to (no type)
			notype_to_type1: data access srcSys.f_notype -> destSys.f_type; -- (no type) -> type
			notype_to_notype1: data access srcSys.f_notype -> destSys.f_notype; -- (no type) -> (no type)
			
			type_to_type2: data access myDataType -> destSys.f_type; -- type -> type
			type_to_notype2: data access myDataType -> destSys.f_notype; -- type to (no type)
			notype_to_type2: data access myDataNoType -> destSys.f_type; -- (no type) -> type
			notype_to_notype2: data access myDataNoType -> destSys.f_notype; -- (no type) -> (no type)			
		properties
			Classifier_Substitution_Rule => Type_Extension;
	end Top.notype_to_notype;
	
	system implementation Top.type_to_type extends Top.notype_to_notype
		-- now we have have c0 as type -> type
		subcomponents
			srcSys: refined to system DataProvider1;
			destSys: refined to system DataConsumer1;
			myData: refined to data D;
	end Top.type_to_type;
	
	system implementation Top.type_to_notype extends Top.notype_to_notype
		-- now we have have c0 as type -> (no type)
		subcomponents
			srcSys: refined to system DataProvider1;
			myData: refined to data D;
	end Top.type_to_notype;
	
	system implementation Top.notype_to_type extends Top.notype_to_notype
		-- now we have have c0 as (no type) -> type
		subcomponents
			destSys: refined to system DataConsumer1;
	end Top.notype_to_type;
end TestDataAccessClassifier;

I would expect some kind of error/warning on the connections type_to_type, etc. in Top.notype_to_notype. The question is what happens to the connection c0 and what happens when connections are instantiated?

In the declarative model, there are 4 warnings

  • 2 for the mismatched connections between features.
  • 2 for the mismatched connections between the data subcomponent and the feature.

There are no errors or warnings on the instantiated systems. This seems wrong. There should be a some kind of message on the following items:

  • Connection instance srcSys.f_notype -> destSys.f_type in all 4 instance models
  • Connection instance srcSys.f_type -> destSys.f_notype in all 4 instance models
  • Connection instance myDataNoType -> destSys.f_type in all 4 instance models
  • Connection instance myDataType -> destSys.f_notype in all 4 instance models
  • Connection instance srcSys.f0 -> destSys.f0 in Top.notype_to_type
  • Connection instance myData -> destSys.f0 in Top.notype_to_type
  • Connection instance srcSys.f0 -> destSys.f0 in Top.type_to_notype
  • Connection instance myData -> destSys.f0 in Top.type_to_notype

Not sure if this should be an error or a warning.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 6, 2020

Need similar example turning abstract feature to data access features.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 12, 2020

Here we have just refining the data classifier of abstract features:

package TestAbstractClassifier
public
	Data D
	end D;
	
	system SrcSys
		features
			f0: out feature;
			
			f_type: out feature D;
			f_notype: out feature;
	end SrcSys;
	
	system SrcSysType extends SrcSys
		features
			f0: refined to out feature D;
	end SrcSysType;
	
	system DestSys
		features
			f0: in feature;
			
			f_type: in feature D;
			f_notype: in feature;
	end DestSys;
	
	system DestSysType extends DestSys
		features
			f0: refined to in feature D;
	end DestSysType;
	
	system Top
	end Top;
	
	system implementation Top.notype_to_notype
		subcomponents
			srcSys: system SrcSys;
			destSys: system DestSys;
		connections
			c0: feature srcSys.f0 -> destSys.f0;  -- (no type) -> (no type)
			
			type_to_type: feature srcSys.f_type -> destSys.f_type;
			type_to_notype: feature srcSys.f_type -> destSys.f_notype;
			notype_to_type: feature srcSys.f_notype -> destSys.f_type;
			notype_to_notype: feature srcSys.f_notype -> destSys.f_notype;
		properties
			Classifier_Substitution_Rule => Type_Extension;
	end Top.notype_to_notype;
	
	system implementation Top.type_to_type extends Top.notype_to_notype
		-- now we have have c0 as type -> type
		subcomponents
			srcSys: refined to system SrcSysType;
			destSys: refined to system DestSysType;
	end Top.type_to_type;
	
	system implementation Top.type_to_notype extends Top.notype_to_notype
		-- now we have have c0 as type -> (no type)
		subcomponents
			srcSys: refined to system SrcSysType;
	end Top.type_to_notype;
	
	system implementation Top.notype_to_type extends Top.notype_to_notype
		-- now we have have c0 as (no type) -> type
		subcomponents
			destSys: refined to system DestSysType;
	end Top.notype_to_type;
end TestAbstractClassifier;

There are no warnings or errors on the declarative model, even on the explicitly mismatched control connections.

There are no errors or warnings on the instance mode.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 12, 2020

Tests for refining abstract features to data access features:

package TestAbstractToDataAccessClassifier
public
	Data D
	end D;
	
	--
	
	system DataProvider_untyped
		features
			f0: feature;
			
			p_type: provides data access D;
			p_notype: provides data access;

			r_type: requires data access D;
			r_notype: requires data access;
	end DataProvider_untyped;
	
	system DataProvider_provides_untyped extends DataProvider_untyped
		features
			f0: refined to provides data access;
	end DataProvider_provides_untyped;
	
	system DataProvider_requires_untyped extends DataProvider_untyped
		features
			f0: refined to requires data access;
	end DataProvider_requires_untyped;
	
	system DataProvider_provides_typed extends DataProvider_provides_untyped
		features
			f0: refined to provides data access D;
	end DataProvider_provides_typed;
	
	system DataProvider_requires_typed extends DataProvider_requires_untyped
		features
			f0: refined to requires data access D;
	end DataProvider_requires_typed;
	
	--
	
	system DataConsumer_untyped
		features
			f0: feature;
			
			p_type: provides data access D;
			p_notype: provides data access;

			r_type: requires data access D;
			r_notype: requires data access;
	end DataConsumer_untyped;
	
	system DataConsumer_provides_untyped extends DataConsumer_untyped
		features
			f0: refined to provides data access;
	end DataConsumer_provides_untyped;
	
	system DataConsumer_requires_untyped extends DataConsumer_untyped
		features
			f0: refined to requires data access;
	end DataConsumer_requires_untyped;
	
	system DataConsumer_provides_typed extends DataConsumer_provides_untyped
		features
			f0: refined to provides data access D;
	end DataConsumer_provides_typed;
	
	system DataConsumer_requires_typed extends DataConsumer_requires_untyped
		features
			f0: refined to requires data access D;
	end DataConsumer_requires_typed;

	--
		
	system Top
	end Top;
	
	system implementation Top.notype_to_notype
		subcomponents
			srcSys: system DataProvider_untyped;
			destSys: system DataConsumer_untyped;
		connections
			c0: feature srcSys.f0 -> destSys.f0;  -- (no type) -> (no type)
			
			c11: data access srcSys.p_type -> destSys.p_type;
			c12: data access srcSys.p_type -> destSys.p_notype;
			c13: data access srcSys.p_type -> destSys.r_type;
			c14: data access srcSys.p_type -> destSys.r_notype;
			
			c21: data access srcSys.p_notype -> destSys.p_type;
			c22: data access srcSys.p_notype -> destSys.p_notype;
			c23: data access srcSys.p_notype -> destSys.r_type;
			c24: data access srcSys.p_notype -> destSys.r_notype;
			
			c31: data access srcSys.r_type -> destSys.p_type;
			c32: data access srcSys.r_type -> destSys.p_notype;
			c33: data access srcSys.r_type -> destSys.r_type;
			c34: data access srcSys.r_type -> destSys.r_notype;
			
			c41: data access srcSys.r_notype -> destSys.p_type;
			c42: data access srcSys.r_notype -> destSys.p_notype;
			c43: data access srcSys.r_notype -> destSys.r_type;
			c44: data access srcSys.r_notype -> destSys.r_notype;
		properties
			Classifier_Substitution_Rule => Type_Extension;
	end Top.notype_to_notype;


	system implementation top.provides_nt_to_provides_nt extends Top.notype_to_notype -- c22
		subcomponents
			srcSys: refined to system DataProvider_provides_untyped;
			destSys: refined to system DataConsumer_provides_untyped;
	end top.provides_nt_to_provides_nt;
	
	system implementation top.provides_nt_to_provides_t extends Top.provides_nt_to_provides_nt -- c21
		subcomponents
			destSys: refined to system DataConsumer_provides_typed;
	end top.provides_nt_to_provides_t;
	
	system implementation top.provides_t_to_provides_nt extends Top.provides_nt_to_provides_nt -- c12
		subcomponents
			srcSys: refined to system DataProvider_provides_typed;
	end top.provides_t_to_provides_nt;
	
	system implementation top.provides_t_to_provides_t extends Top.provides_nt_to_provides_nt -- c11
		subcomponents
			srcSys: refined to system DataProvider_provides_typed;
			destSys: refined to system DataConsumer_provides_typed;
	end top.provides_t_to_provides_t;
	
	
	system implementation top.provides_nt_to_requires_nt extends Top.notype_to_notype -- c24
		subcomponents
			srcSys: refined to system DataProvider_provides_untyped;
			destSys: refined to system DataConsumer_requires_untyped;
	end top.provides_nt_to_requires_nt;

	system implementation top.provides_nt_to_requires_t extends Top.provides_nt_to_requires_nt -- c23
		subcomponents
			destSys: refined to system DataConsumer_requires_typed;
	end top.provides_nt_to_requires_t;

	system implementation top.provides_t_to_requires_nt extends Top.provides_nt_to_requires_nt -- c14
		subcomponents
			srcSys: refined to system DataProvider_provides_typed;
	end top.provides_t_to_requires_nt;

	system implementation top.provides_t_to_requires_t extends Top.provides_nt_to_requires_nt -- c13
		subcomponents
			srcSys: refined to system DataProvider_provides_typed;
			destSys: refined to system DataConsumer_requires_typed;
	end top.provides_t_to_requires_t;


	system implementation top.requires_nt_to_provides_nt extends Top.notype_to_notype -- c42
		subcomponents
			srcSys: refined to system DataProvider_requires_untyped;
			destSys: refined to system DataConsumer_provides_untyped;
	end top.requires_nt_to_provides_nt;

	system implementation top.requires_nt_to_provides_t extends Top.requires_nt_to_provides_nt -- c41
		subcomponents
			destSys: refined to system DataConsumer_provides_typed;
	end top.requires_nt_to_provides_t;

	system implementation top.requires_t_to_provides_nt extends Top.requires_nt_to_provides_nt -- c32
		subcomponents
			srcSys: refined to system DataProvider_requires_typed;
	end top.requires_t_to_provides_nt;

	system implementation top.requires_t_to_provides_t extends Top.requires_nt_to_provides_nt -- r31
		subcomponents
			srcSys: refined to system DataProvider_requires_typed;
			destSys: refined to system DataConsumer_provides_typed;
	end top.requires_t_to_provides_t;

	
	system implementation top.requires_nt_to_requires_nt extends Top.notype_to_notype -- c44
		subcomponents
			srcSys: refined to system DataProvider_requires_untyped;
			destSys: refined to system DataConsumer_requires_untyped;
	end top.requires_nt_to_requires_nt;
	
	system implementation top.requires_nt_to_requires_t extends Top.requires_nt_to_requires_nt -- c43
		subcomponents
			destSys: refined to system DataConsumer_requires_typed;
	end top.requires_nt_to_requires_t;
	
	system implementation top.requires_t_to_requires_nt extends Top.requires_nt_to_requires_nt -- c34
		subcomponents
			srcSys: refined to system DataProvider_requires_typed;
	end top.requires_t_to_requires_nt;
	
	system implementation top.requires_t_to_requires_t extends Top.requires_nt_to_requires_nt -- c33
		subcomponents
			srcSys: refined to system DataProvider_requires_typed;
			destSys: refined to system DataConsumer_requires_typed;
	end top.requires_t_to_requires_t;
end TestAbstractToDataAccessClassifier;

Here we test both data classifier–no data classifier and requires–provides, so there are 16 different combinations.

In the declarative model we have

  • warnings on the control connections when one end has a classifier and the other does not
  • errors on the control connections when they are between two requires or between two provides

There are no errors on the instance model:

  • All 16 system instances have all 17 connection instances in place.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 13, 2020

Looking at TestAbstractDirection example more closely. Again, this one works correctly, in that bad connections are not created, but we do not have as many error messages as we woud like. This is not easy to fix:

  1. CreateConnectionsSwitch.instantiateConnections() only tries to create connections from non-in features, as determined by AadlUtil.hasOutgoingFeatures().
  2. The error message reported on out to out connections is generated later in the process in the middle of appendSegment().

Considering that the bad connections are not generated, I think we can consider this "good enough".

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 13, 2020

For TestDataPortClassifier, TestDataAccessClassifier, TestAbstractClassifier, and TestAbstractToDataAccessClassifier we can add checks that are called at the end of addConnectionInstance() instead of creating a whole new visitor to check connections.

TestAbstractClassifier needs to have additional declarative model checks as well.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 13, 2020

First up, why do the declarative checks that work for TestDataPortClassifier not work for TestAbstractClassifier?

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 13, 2020

Aadl2JavaValidator.caseFeatureConnection() doesn't check the classifiers of the end points like caseAccessConnection(), casePortConnection(), and caseParameterConnection() does.

Interestingly, this seems to be because the spec doesn't specify any such checks for feature connections in the legality rules of section 9.1.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 13, 2020

Not sure what is the correct way to report the classifier problems:

  • Checking reporting on the instance model means replicating the stuff from Aadl2JavaValidator.checkPortConnectionClassifiers() and friends for the instance model.

  • Alternatively, it could be checked on the declarative model by rechecking all the inherited connections in a classifier considering any refinements present in the classifier. But this becomes similar to the process that is used to create instance models.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 14, 2020

The bad provides to provides and requires to requires connection instances are created because the check in CreateConnectionsSwitch.instantiateConnections() uses AadlUtil.hasOutgoingFeatures(). access features do not have direction, so they are always outgoing.

Need to check this on the connection instances after they are created.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 14, 2020

From discussing with @lwrage :

  • Put the new checks in ValidateConnectionsSwitch. We could check as they are created, but we do not want to make CreateConnnectionsSwitch any more horrible than it already is.

  • Get rid of CheckInstanceSemanticsSwitch if possible.

  • Add warnings and errors to the connection instances

  • Test the case of a component inside another component that connects to the outer component and then connects to a peer.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 21, 2020

Created tests where there is a nested subcomponent, and the connection comes

  1. up from the subcomponent to a containing component and then to a peer
  2. and the opposite, from a peer and then down to a subcomponent

Each case has 27 subcases (in, out, no direction)^3

package TestNestedAbstractDirection_OutOfComponent
public
	Data D
	end D;
	
	system InnerSys_blank
		features
			f0: feature;
			
			blank_feature: feature;
			out_feature: out feature;
			in_feature: in feature;
		properties
			Classifier_Substitution_Rule => Type_Extension;
	end InnerSys_blank;
	
	system InnerSys_out extends InnerSys_blank
		features
			f0: refined to out feature;
	end InnerSys_out;
	
	system InnerSys_in extends InnerSys_blank
		features
			f0: refined to in feature;
	end InnerSys_in;
	
	--
	
	system SrcSys
		features
			f0: feature;
			
			blank_to_blank_feature: feature;
			blank_to_out_feature: out feature;
			blank_to_in_feature: in feature;
			
			out_to_blank_feature: feature;
			out_to_out_feature: out feature;
			out_to_in_feature: in feature;
			
			in_to_blank_feature: feature;
			in_to_out_feature: out feature;
			in_to_in_feature: in feature;
		properties
			Classifier_Substitution_Rule => Type_Extension;
	end SrcSys;
		
	system SrcSysOut extends SrcSys
		features
			f0: refined to out feature;
	end SrcSysOut;
		
	system SrcSysIn extends SrcSys
		features
			f0: refined to in feature;
	end SrcSysIn;
		
	system implementation SrcSys.blank_to_blank
		subcomponents
			s: system InnerSys_blank;
		connections
			c0: feature s.f0 -> f0;
			
			blank_to_blank: feature s.blank_feature -> blank_to_blank_feature; 
			blank_to_out: feature s.blank_feature -> blank_to_out_feature;  
			blank_to_in: feature s.blank_feature -> blank_to_in_feature;  -- BAD

			out_to_blank: feature s.out_feature -> out_to_blank_feature; 
			out_to_out: feature s.out_feature -> out_to_out_feature; 
			out_to_in: feature s.out_feature -> out_to_in_feature;  -- BAD
			
			in_to_blank: feature s.in_feature -> in_to_blank_feature;  -- BAD
			in_to_out: feature s.in_feature -> in_to_out_feature;  -- BAD
			in_to_in: feature s.in_feature -> in_to_in_feature; -- BAD
	end SrcSys.blank_to_blank;
		
	system implementation SrcSys.out_to_blank extends SrcSys.blank_to_blank
		subcomponents
			s: refined to system InnerSys_out;
	end SrcSys.out_to_blank;
		
	system implementation SrcSys.in_to_blank extends SrcSys.blank_to_blank
		subcomponents
			s: refined to system InnerSys_in;
	end SrcSys.in_to_blank;
	
	system implementation SrcSysOut.blank_to_out extends SrcSys.blank_to_blank
	end SrcSysOut.blank_to_out;
	
	system implementation SrcSysOut.out_to_out extends SrcSysOut.blank_to_out
		subcomponents
			s: refined to system InnerSys_out;
	end SrcSysOut.out_to_out;
	
	system implementation SrcSysOut.in_to_out extends SrcSysOut.blank_to_out
		subcomponents
			s: refined to system InnerSys_in;
	end SrcSysOut.in_to_out;
	
	system implementation SrcSysIn.blank_to_in extends SrcSys.blank_to_blank
	end SrcSysIn.blank_to_in;
	
	system implementation SrcSysIn.out_to_in extends SrcSysIn.blank_to_in
		subcomponents
			s: refined to system InnerSys_out;
	end SrcSysIn.out_to_in;
	
	system implementation SrcSysIn.in_to_in extends SrcSysIn.blank_to_in
		subcomponents
			s: refined to system InnerSys_in;
	end SrcSysIn.in_to_in;
	
	--
	
	system DestSys
		features
			f0: feature;
			
			blank_feature: feature;
			out_feature: out feature;
			in_feature: in feature;
	end DestSys;
	
	system DestSysIn extends DestSys
		features
			f0: refined to in feature;
	end DestSysIn;
	
	system DestSysOut extends DestSys
		features
			f0: refined to out feature;
	end DestSysOut;
	
	system Top
		properties
			Classifier_Substitution_Rule => Type_Extension;
	end Top;
	
	system implementation Top.blank_to_blank_to_blank
		subcomponents
			srcSys: system SrcSys.blank_to_blank;
			destSys: system DestSys;
		connections
			c0: feature srcSys.f0 -> destSys.f0;
			
			blank_to_blank_to_blank: feature srcSys.blank_to_blank_feature -> destSys.blank_feature;
			blank_to_blank_to_out: feature srcSys.blank_to_blank_feature -> destSys.out_feature; -- BAD, cannot end at OUT
			blank_to_blank_to_in: feature srcSys.blank_to_blank_feature -> destSys.in_feature; 

			blank_to_out_to_blank: feature srcSys.blank_to_out_feature -> destSys.blank_feature;
			blank_to_out_to_out: feature srcSys.blank_to_out_feature -> destSys.out_feature; -- BAD, cannot end at OUT
			blank_to_out_to_in: feature srcSys.blank_to_out_feature -> destSys.in_feature;
			
			-- blank_to_in is BAD, shouldn't even process it during instantiation
			-- Also, cannot start connection from an IN in the peer to peer case
			blank_to_in_to_blank: feature srcSys.blank_to_in_feature -> destSys.blank_feature; -- BAD
			blank_to_in_to_out: feature srcSys.blank_to_in_feature -> destSys.out_feature; -- BAD, cannot end at OUT
			blank_to_in_to_in: feature srcSys.blank_to_in_feature -> destSys.in_feature; -- BAD
			
			out_to_blank_to_blank: feature srcSys.out_to_blank_feature -> destSys.blank_feature;
			out_to_blank_to_out: feature srcSys.out_to_blank_feature -> destSys.out_feature; -- BAD
			out_to_blank_to_in: feature srcSys.out_to_blank_feature -> destSys.in_feature;

			out_to_out_to_blank: feature srcSys.out_to_out_feature -> destSys.blank_feature;
			out_to_out_to_out: feature srcSys.out_to_out_feature -> destSys.out_feature; -- BAD, cannot end at OUT
			out_to_out_to_in: feature srcSys.out_to_out_feature -> destSys.in_feature;
			
			-- out_to_in is BAD, shouldn't even process it during instantiation
			-- Also, cannot start connection from an IN in the peer to peer case
			out_to_in_to_blank: feature srcSys.out_to_in_feature -> destSys.blank_feature;
			out_to_in_to_out: feature srcSys.out_to_in_feature -> destSys.out_feature; -- BAD, cannot end at OUT
			out_to_in_to_in: feature srcSys.out_to_in_feature -> destSys.in_feature;
			
			-- in_to_blank is BAD, shouldn't even process it during instantiation
			in_to_blank_to_blank: feature srcSys.in_to_blank_feature -> destSys.blank_feature;
			in_to_blank_to_out: feature srcSys.in_to_blank_feature -> destSys.out_feature;
			in_to_blank_to_in: feature srcSys.in_to_blank_feature -> destSys.in_feature;

			-- in_to_blank is BAD, shouldn't even process it during instantiation
			in_to_out_to_blank: feature srcSys.in_to_out_feature -> destSys.blank_feature;
			in_to_out_to_out: feature srcSys.in_to_out_feature -> destSys.out_feature; -- BAD, cannot end at OUT
			in_to_out_to_in: feature srcSys.in_to_out_feature -> destSys.in_feature;
			
			-- in_to_blank is BAD, shouldn't even process it during instantiation
			-- Also, cannot start connection from an IN in the peer to peer case
			in_to_in_to_blank: feature srcSys.in_to_in_feature -> destSys.blank_feature;
			in_to_in_to_out: feature srcSys.in_to_in_feature -> destSys.out_feature; -- BAD, cannot end at OUT
			in_to_in_to_in: feature srcSys.in_to_in_feature -> destSys.in_feature;
	end Top.blank_to_blank_to_blank;
	
	system implementation Top.blank_to_blank_to_out extends Top.blank_to_blank_to_blank 
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.blank_to_blank_to_out;
	
	system implementation Top.blank_to_blank_to_in extends Top.blank_to_blank_to_blank 
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.blank_to_blank_to_in;
	
	
	system implementation Top.blank_to_out_to_blank extends Top.blank_to_blank_to_blank
		subcomponents
			srcSys: refined to system SrcSysOut.blank_to_out;
	end Top.blank_to_out_to_blank;
	
	system implementation Top.blank_to_out_to_out extends Top.blank_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.blank_to_out_to_out;
	
	system implementation Top.blank_to_out_to_in extends Top.blank_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.blank_to_out_to_in;
	
	
	system implementation Top.blank_to_in_to_blank extends Top.blank_to_blank_to_blank
		subcomponents
			srcSys: refined to system SrcSysIn.blank_to_in;
	end Top.blank_to_in_to_blank;
	
	system implementation Top.blank_to_in_to_out extends Top.blank_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.blank_to_in_to_out;
	
	system implementation Top.blank_to_in_to_in extends Top.blank_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.blank_to_in_to_in;
	
	
	system implementation Top.out_to_blank_to_blank extends Top.blank_to_blank_to_blank 
		subcomponents
			srcSys: refined to system SrcSys.out_to_blank;
	end Top.out_to_blank_to_blank;
	
	system implementation Top.out_to_blank_to_out extends Top.out_to_blank_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.out_to_blank_to_out;
	
	system implementation Top.out_to_blank_to_in extends Top.out_to_blank_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.out_to_blank_to_in;
	
	
	system implementation Top.out_to_out_to_blank extends Top.blank_to_blank_to_blank 
		subcomponents
			srcSys: refined to system SrcSysOut.out_to_out;
	end Top.out_to_out_to_blank;
	
	system implementation Top.out_to_out_to_out extends Top.out_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.out_to_out_to_out;
	
	system implementation Top.out_to_out_to_in extends Top.out_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.out_to_out_to_in;
	
	
	system implementation Top.out_to_in_to_blank extends Top.blank_to_blank_to_blank 
		subcomponents
			srcSys: refined to system SrcSysIn.out_to_in;
	end Top.out_to_in_to_blank;
	
	system implementation Top.out_to_in_to_out extends Top.out_to_in_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.out_to_in_to_out;
	
	system implementation Top.out_to_in_to_in extends Top.out_to_in_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.out_to_in_to_in;
	
	
	system implementation Top.in_to_blank_to_blank extends Top.blank_to_blank_to_blank 
		subcomponents
			srcSys: refined to system SrcSys.in_to_blank;
	end Top.in_to_blank_to_blank;
	
	system implementation Top.in_to_blank_to_out extends Top.in_to_blank_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.in_to_blank_to_out;
	
	system implementation Top.in_to_blank_to_in extends Top.in_to_blank_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.in_to_blank_to_in;
	
	
	system implementation Top.in_to_out_to_blank extends Top.blank_to_blank_to_blank 
		subcomponents
			srcSys: refined to system SrcSysOut.in_to_out;
	end Top.in_to_out_to_blank;
	
	system implementation Top.in_to_out_to_out extends Top.in_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.in_to_out_to_out;
	
	system implementation Top.in_to_out_to_in extends Top.in_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.in_to_out_to_in;
	
	
	system implementation Top.in_to_in_to_blank extends Top.blank_to_blank_to_blank 
		subcomponents
			srcSys: refined to system SrcSysOut.in_to_out;
	end Top.in_to_in_to_blank;
	
	system implementation Top.in_to_in_to_out extends Top.in_to_in_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.in_to_in_to_out;
	
	system implementation Top.in_to_in_to_in extends Top.in_to_in_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.in_to_in_to_in;
end TestNestedAbstractDirection_OutOfComponent;
package TestNestedAbstractDirection_InToComponent
public
	Data D
	end D;
	
	system InnerSys_blank
		features
			f0: feature;
			
			blank_feature: feature;
			out_feature: out feature;
			in_feature: in feature;
		properties
			Classifier_Substitution_Rule => Type_Extension;
	end InnerSys_blank;
	
	system InnerSys_out extends InnerSys_blank
		features
			f0: refined to out feature;
	end InnerSys_out;
	
	system InnerSys_in extends InnerSys_blank
		features
			f0: refined to in feature;
	end InnerSys_in;
	
	--
	
	system SrcSys
		features
			f0: feature;
			
			blank_to_blank_feature: feature;
			blank_to_out_feature: out feature;
			blank_to_in_feature: in feature;
			
			out_to_blank_feature: feature;
			out_to_out_feature: out feature;
			out_to_in_feature: in feature;
			
			in_to_blank_feature: feature;
			in_to_out_feature: out feature;
			in_to_in_feature: in feature;
		properties
			Classifier_Substitution_Rule => Type_Extension;
	end SrcSys;
		
	system SrcSysOut extends SrcSys
		features
			f0: refined to out feature;
	end SrcSysOut;
		
	system SrcSysIn extends SrcSys
		features
			f0: refined to in feature;
	end SrcSysIn;
		
	system implementation SrcSys.blank_to_blank
		subcomponents
			s: system InnerSys_blank;
		connections
			c0: feature f0 -> s.f0;
			
			blank_to_blank: feature blank_to_blank_feature -> s.blank_feature;
			blank_to_out: feature blank_to_out_feature -> s.blank_feature; -- BAD: cannot start at out
			blank_to_in: feature blank_to_in_feature -> s.blank_feature;

			-- All of these are bad because the connection cannot end an "out" feature of a subcomponent
			out_to_blank: feature out_to_blank_feature -> s.out_feature; 
			out_to_out: feature out_to_out_feature -> s.out_feature;  -- BAD: cannot start at out
			out_to_in: feature out_to_in_feature -> s.out_feature;  
			
			in_to_blank: feature in_to_blank_feature -> s.in_feature;
			in_to_out: feature in_to_out_feature -> s.in_feature;  -- BAD: cannot start at out
			in_to_in: feature in_to_in_feature -> s.in_feature; 
	end SrcSys.blank_to_blank;
		
	system implementation SrcSys.out_to_blank extends SrcSys.blank_to_blank
		subcomponents
			s: refined to system InnerSys_out;
	end SrcSys.out_to_blank;
		
	system implementation SrcSys.in_to_blank extends SrcSys.blank_to_blank
		subcomponents
			s: refined to system InnerSys_in;
	end SrcSys.in_to_blank;
	
	system implementation SrcSysOut.blank_to_out extends SrcSys.blank_to_blank
	end SrcSysOut.blank_to_out;
	
	system implementation SrcSysOut.out_to_out extends SrcSysOut.blank_to_out
		subcomponents
			s: refined to system InnerSys_out;
	end SrcSysOut.out_to_out;
	
	system implementation SrcSysOut.in_to_out extends SrcSysOut.blank_to_out
		subcomponents
			s: refined to system InnerSys_in;
	end SrcSysOut.in_to_out;
	
	system implementation SrcSysIn.blank_to_in extends SrcSys.blank_to_blank
	end SrcSysIn.blank_to_in;
	
	system implementation SrcSysIn.out_to_in extends SrcSysIn.blank_to_in
		subcomponents
			s: refined to system InnerSys_out;
	end SrcSysIn.out_to_in;
	
	system implementation SrcSysIn.in_to_in extends SrcSysIn.blank_to_in
		subcomponents
			s: refined to system InnerSys_in;
	end SrcSysIn.in_to_in;
	
	--
	
	system DestSys
		features
			f0: feature;
			
			blank_feature: feature;
			out_feature: out feature;
			in_feature: in feature;
	end DestSys;
	
	system DestSysIn extends DestSys
		features
			f0: refined to in feature;
	end DestSysIn;
	
	system DestSysOut extends DestSys
		features
			f0: refined to out feature;
	end DestSysOut;
	
	system Top
		properties
			Classifier_Substitution_Rule => Type_Extension;
	end Top;
	
	system implementation Top.blank_to_blank_to_blank
		subcomponents
			srcSys: system SrcSys.blank_to_blank;
			destSys: system DestSys;
		connections
			c0: feature destSys.f0 -> srcSys.f0;
			
			blank_to_blank_to_blank: feature destSys.blank_feature -> srcSys.blank_to_blank_feature;
			blank_to_blank_to_out: feature destSys.out_feature -> srcSys.blank_to_blank_feature;
			blank_to_blank_to_in: feature destSys.in_feature -> srcSys.blank_to_blank_feature; -- BAD: Cannot start at "in" when peer to peer

			-- blank_to_out is BAD, shouldn't even process it during instantiation
			blank_to_out_to_blank: feature destSys.blank_feature -> srcSys.blank_to_out_feature; -- BAD: Cannot end with "out" when peer to peer
			blank_to_out_to_out: feature destSys.out_feature -> srcSys.blank_to_out_feature; -- BAD: Cannot end with "out" when peer to peer
			blank_to_out_to_in: feature destSys.in_feature -> srcSys.blank_to_out_feature; -- BAD: Cannot start at "in" when peer to peer; Cannot end with "out" when peer to peer
			
			blank_to_in_to_blank: feature destSys.blank_feature -> srcSys.blank_to_in_feature;
			blank_to_in_to_out: feature destSys.out_feature -> srcSys.blank_to_in_feature;
			blank_to_in_to_in: feature destSys.in_feature -> srcSys.blank_to_in_feature; -- BAD: Cannot start at "in" when peer to peer
			
			-- out_to_blank is BAD, shouldn't even process it during instantiation
			out_to_blank_to_blank: feature destSys.blank_feature -> srcSys.out_to_blank_feature;
			out_to_blank_to_out: feature destSys.out_feature -> srcSys.out_to_blank_feature;
			out_to_blank_to_in: feature destSys.in_feature -> srcSys.out_to_blank_feature; -- BAD: Cannot start at "in" when peer to peer

			-- out_to_out is BAD, shouldn't even process it during instantiation
			out_to_out_to_blank: feature destSys.blank_feature -> srcSys.out_to_out_feature; -- BAD: Cannot end with "out" when peer to peer
			out_to_out_to_out: feature destSys.out_feature -> srcSys.out_to_out_feature; -- BAD: Cannot end with "out" when peer to peer
			out_to_out_to_in: feature destSys.in_feature -> srcSys.out_to_out_feature; -- BAD: Cannot start at "in" when peer to peer; Cannot end with "out" when peer to peer
			
			-- out_to_in is BAD, shouldn't even process it during instantiation
			out_to_in_to_blank: feature destSys.blank_feature -> srcSys.out_to_in_feature;
			out_to_in_to_out: feature destSys.out_feature -> srcSys.out_to_in_feature;
			out_to_in_to_in: feature destSys.in_feature -> srcSys.out_to_in_feature; -- BAD: Cannot start at "in" when peer to peer
			
			in_to_blank_to_blank: feature destSys.blank_feature -> srcSys.in_to_blank_feature;
			in_to_blank_to_out: feature destSys.out_feature -> srcSys.in_to_blank_feature;
			in_to_blank_to_in: feature destSys.in_feature -> srcSys.in_to_blank_feature; -- BAD: Cannot start at "in" when peer to peer

			-- in_to_out is BAD, shouldn't even process it during instantiation
			in_to_out_to_blank: feature destSys.blank_feature -> srcSys.in_to_out_feature; -- BAD: Cannot end with "out" when peer to peer
			in_to_out_to_out: feature destSys.out_feature -> srcSys.in_to_out_feature; -- BAD: Cannot end with "out" when peer to peer
			in_to_out_to_in: feature destSys.in_feature -> srcSys.in_to_out_feature; -- BAD: Cannot start at "in" when peer to peer; Cannot end with "out" when peer to peer
			
			in_to_in_to_blank: feature destSys.blank_feature -> srcSys.in_to_in_feature;
			in_to_in_to_out: feature destSys.out_feature -> srcSys.in_to_in_feature;
			in_to_in_to_in: feature destSys.in_feature -> srcSys.in_to_in_feature; -- BAD: Cannot start at "in" when peer to peer
	end Top.blank_to_blank_to_blank;
	
	system implementation Top.blank_to_blank_to_out extends Top.blank_to_blank_to_blank 
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.blank_to_blank_to_out;
	
	system implementation Top.blank_to_blank_to_in extends Top.blank_to_blank_to_blank 
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.blank_to_blank_to_in;
	
	
	system implementation Top.blank_to_out_to_blank extends Top.blank_to_blank_to_blank
		subcomponents
			srcSys: refined to system SrcSysOut.blank_to_out;
	end Top.blank_to_out_to_blank;
	
	system implementation Top.blank_to_out_to_out extends Top.blank_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.blank_to_out_to_out;
	
	system implementation Top.blank_to_out_to_in extends Top.blank_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.blank_to_out_to_in;
	
	
	system implementation Top.blank_to_in_to_blank extends Top.blank_to_blank_to_blank
		subcomponents
			srcSys: refined to system SrcSysIn.blank_to_in;
	end Top.blank_to_in_to_blank;
	
	system implementation Top.blank_to_in_to_out extends Top.blank_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.blank_to_in_to_out;
	
	system implementation Top.blank_to_in_to_in extends Top.blank_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.blank_to_in_to_in;
	
	
	system implementation Top.out_to_blank_to_blank extends Top.blank_to_blank_to_blank 
		subcomponents
			srcSys: refined to system SrcSys.out_to_blank;
	end Top.out_to_blank_to_blank;
	
	system implementation Top.out_to_blank_to_out extends Top.out_to_blank_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.out_to_blank_to_out;
	
	system implementation Top.out_to_blank_to_in extends Top.out_to_blank_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.out_to_blank_to_in;
	
	
	system implementation Top.out_to_out_to_blank extends Top.blank_to_blank_to_blank 
		subcomponents
			srcSys: refined to system SrcSysOut.out_to_out;
	end Top.out_to_out_to_blank;
	
	system implementation Top.out_to_out_to_out extends Top.out_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.out_to_out_to_out;
	
	system implementation Top.out_to_out_to_in extends Top.out_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.out_to_out_to_in;
	
	
	system implementation Top.out_to_in_to_blank extends Top.blank_to_blank_to_blank 
		subcomponents
			srcSys: refined to system SrcSysIn.out_to_in;
	end Top.out_to_in_to_blank;
	
	system implementation Top.out_to_in_to_out extends Top.out_to_in_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.out_to_in_to_out;
	
	system implementation Top.out_to_in_to_in extends Top.out_to_in_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.out_to_in_to_in;
	
	
	system implementation Top.in_to_blank_to_blank extends Top.blank_to_blank_to_blank 
		subcomponents
			srcSys: refined to system SrcSys.in_to_blank;
	end Top.in_to_blank_to_blank;
	
	system implementation Top.in_to_blank_to_out extends Top.in_to_blank_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.in_to_blank_to_out;
	
	system implementation Top.in_to_blank_to_in extends Top.in_to_blank_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.in_to_blank_to_in;
	
	
	system implementation Top.in_to_out_to_blank extends Top.blank_to_blank_to_blank 
		subcomponents
			srcSys: refined to system SrcSysOut.in_to_out;
	end Top.in_to_out_to_blank;
	
	system implementation Top.in_to_out_to_out extends Top.in_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.in_to_out_to_out;
	
	system implementation Top.in_to_out_to_in extends Top.in_to_out_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.in_to_out_to_in;
	
	
	system implementation Top.in_to_in_to_blank extends Top.blank_to_blank_to_blank 
		subcomponents
			srcSys: refined to system SrcSysOut.in_to_out;
	end Top.in_to_in_to_blank;
	
	system implementation Top.in_to_in_to_out extends Top.in_to_in_to_blank
		subcomponents
			destSys: refined to system DestSysOut;
	end Top.in_to_in_to_out;
	
	system implementation Top.in_to_in_to_in extends Top.in_to_in_to_blank
		subcomponents
			destSys: refined to system DestSysIn;
	end Top.in_to_in_to_in;
end TestNestedAbstractDirection_InToComponent;

The declarative errors seem to be correct.

The instance model is correct: None of the bad connection instances are created in the top-level model.

instantiating just the SrcSys model doesn't work correctly. The bad connections are still created. This is a duplicate of the earlier errors in other test cases above.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 22, 2020

First check to add:

  • Check that the classifiers on the end points of connection instances match

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented May 22, 2020

Classifier matching is in general not checked on connection instances. Consider the example here:

package TestDataPortClassifierMatching
public
	Data D
	end D;
	
	Data X
	end X;
	
	system SrcSys
		features
			f0: out data port;
			
			f_type: out data port D;
			f_x: out data port X;
	end SrcSys;
	
	system SrcSys_D extends SrcSys
		features
			f0: refined to out data port D;
	end SrcSys_D;
	
	system SrcSys_X extends SrcSys
		features
			f0: refined to out data port X;
	end SrcSys_X;
	
	system DestSys
		features
			f0: in data port;
			
			f_type: in data port D;
			f_x: in data port X;
	end DestSys;
	
	system DestSys_D extends DestSys
		features
			f0: refined to in data port D;
	end DestSys_D;
	
	system DestSys_X extends DestSys
		features
			f0: refined to in data port X;
	end DestSys_X;
	
	system Top
	end Top;
	
	system implementation Top.notype_to_notype
		subcomponents
			srcSys: system SrcSys;
			destSys: system DestSys;
		connections
			c0: port srcSys.f0 -> destSys.f0;  -- (no type) -> (no type)
			
			d_to_d: port srcSys.f_type -> destSys.f_type; -- type -> type
			d_to_x: port srcSys.f_type -> destSys.f_x; -- type to (no type)
			x_to_d: port srcSys.f_x -> destSys.f_type; -- (no type) -> type
			x_to_x: port srcSys.f_x -> destSys.f_x; -- (no type) -> (no type)
		properties
			Classifier_Substitution_Rule => Type_Extension;
	end Top.notype_to_notype;
	
	system implementation Top.d_to_d extends Top.notype_to_notype
		subcomponents
			srcSys: refined to system SrcSys_D;
			destSys: refined to system DestSys_D;
	end Top.d_to_d;
	
	system implementation Top.d_to_x extends Top.notype_to_notype
		subcomponents
			srcSys: refined to system SrcSys_D;
			destSys: refined to system DestSys_X;
	end Top.d_to_x;
	
	system implementation Top.x_to_d extends Top.notype_to_notype
		subcomponents
			srcSys: refined to system SrcSys_X;
			destSys: refined to system DestSys_D;
	end Top.x_to_d;
	
	system implementation Top.x_to_x extends Top.notype_to_notype
		subcomponents
			srcSys: refined to system SrcSys_X;
			destSys: refined to system DestSys_X;
	end Top.x_to_x;
end TestDataPortClassifierMatching;

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented Jun 1, 2020

Fixed classifier matching in the general case. Need to add the other 2 cases.

Fixed ConnectionInfo.addSegment() in the connection instantiation process to not create connections with mismatched requires and provides.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented Jun 2, 2020

Just to be clear on what I actually fixed here:

  1. Added a check to ValidateConnectionsSwitch that checks that classifiers of the connection end points.

  2. Fixed the connection instantiation process via ConnectionInfo.addSegment() to not create connections that have illegal access connections based on provides and requires.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented Jun 2, 2020

I've checked that existing reg test still work.

Need to create new ones.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented Jun 2, 2020

Actually my fix to ConnectionInfo.addSegment() was not sufficient. It is not processing connections whose endpoints are features that have been refined correctly.

This is really annoying because I need the actual refined features to make this test, but the current instantiation process doesn't get them.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented Jun 2, 2020

The information I need is in the ConnectionInfo src and from the method ConnectionInfo.resolveFeatureInstance(). But I need to rejigger things to actually get the info I need.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented Jun 5, 2020

THis is as fixed as it is going to get.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants