예제 #1
0
 public override bool IsAssignableFrom(PLanguageType otherType)
 {
     return(otherType.Canonicalize() is NamedTupleType other &&
            Fields.Count == other.Fields.Count &&
            Names.SequenceEqual(other.Names) &&
            Types.Zip(other.Types, (myT, otherT) => myT.IsAssignableFrom(otherT)).All(x => x));
 }
예제 #2
0
파일: MapType.cs 프로젝트: tushetodorov/P
 public override bool IsAssignableFrom(PLanguageType otherType)
 {
     // Copying semantics: both the other key and value types must be subtypes of this key/value type.
     return(otherType.Canonicalize() is MapType other &&
            KeyType.IsAssignableFrom(other.KeyType) &&
            ValueType.IsAssignableFrom(other.ValueType));
 }
예제 #3
0
파일: TupleType.cs 프로젝트: yzhang90/P-1
 public override bool IsAssignableFrom(PLanguageType otherType)
 {
     // Tuples must be of the same size, and other tuple's fields must subtype this one's
     return(otherType.Canonicalize() is TupleType other &&
            Types.Count == other.Types.Count &&
            Types.Zip(other.Types, (myT, otherT) => myT.IsAssignableFrom(otherT))
            .All(x => x));
 }
예제 #4
0
 public override bool IsAssignableFrom(PLanguageType otherType)
 {
     // Copying semantics: Can assign to a sequence variable if the other sequence's elements are subtypes of this sequence's elements.
     return(otherType.Canonicalize() is SequenceType other && ElementType.IsAssignableFrom(other.ElementType));
 }
예제 #5
0
 public override bool IsAssignableFrom(PLanguageType otherType)
 {
     return(otherType.Canonicalize() is ForeignType other &&
            CanonicalRepresentation == other.CanonicalRepresentation);
 }
예제 #6
0
 public static bool TypeIsOfKind(PLanguageType type, TypeKind kind)
 {
     return(type.Canonicalize().TypeKind.Equals(kind));
 }