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)); }
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)); }
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)); }
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)); }
public override bool IsAssignableFrom(PLanguageType otherType) { return(otherType.Canonicalize() is ForeignType other && CanonicalRepresentation == other.CanonicalRepresentation); }
public static bool TypeIsOfKind(PLanguageType type, TypeKind kind) { return(type.Canonicalize().TypeKind.Equals(kind)); }