Project

General

Profile

Revision 12

Added by over 7 years ago

latest version of the ooas compiler, with grammar version 1.10

View differences:

Type.java
284 284
						 * A cover type of a list must not change the size of the inner type. Mostly what is
285 285
						 * allowed to change is the list length.
286 286
						 */
287
						Type subtype = listt1.innerType();
288
						final boolean castAllowed = TypeEqual(listt1.innerType(), listt2.innerType())
289
						          || (    (listt1.innerType().kind() == TypeKind.OoActionSystemType)
290
						               && (subtype = Type.CoverType(listt1.innerType(), listt2.innerType())) != null);
287
						final Type innerType1 = listt1.innerType();
288
						final Type innerType2 = listt2.innerType();
289
						Type resultInner = innerType1;
290
						final boolean castAllowed = TypeEqual(innerType1, innerType2)
291
						          ||     (resultInner = Type.CoverType(innerType1, innerType2)) != null;
291 292
						if (castAllowed){
292 293
							final int maxelems = listt1.maxNumberOfElements() > listt2.maxNumberOfElements()
293 294
							                ? listt1.maxNumberOfElements()
294 295
							                : listt2.maxNumberOfElements();
295
							return new ListType(subtype, maxelems, null);
296
							return new ListType(resultInner, maxelems, null);
296 297
						} else
297 298
							return null;
298 299

  
......
438 439
				return false;
439 440
			case OoActionSystemType:
440 441
				return false;
442
			case MetaType:
443
				return Type.FirstTypeLessRange( ((MetaType)type1).Type() , ((MetaType)type2).Type());
441 444
			case OpaqueType:
442 445
				assert(false);
443 446
				return false;
......
494 497
				return true;
495 498
			case OoActionSystemType:
496 499
				return type1 == type2; // ref equ.
500
			case MetaType:
501
				return Type.TypeEqualByKind( ((MetaType)type1).Type() , ((MetaType)type2).Type());
497 502
			case OpaqueType:
498 503
				assert(false);
499 504
				return false;
......
569 574
				return true;
570 575
			case OoActionSystemType:
571 576
				return type1 == type2; // ref equ. // || Covariance((OoActionSystemType)type1, (OoActionSystemType)type2);
577
			case MetaType:
578
				return Type.TypeEqual( ((MetaType)type1).Type() , ((MetaType)type2).Type());
572 579
			case OpaqueType:
573 580
				assert(false);
574 581
				return false;

Also available in: Unified diff