public TypeParameter (TypeParameterSpec spec, TypeSpec parentSpec, MemberName name, Attributes attrs)
: base (null, name, attrs)
{
- this.spec = new TypeParameterSpec (parentSpec, spec.DeclaredPosition, spec.MemberDefinition, spec.SpecialConstraint, spec.Variance, null) {
+ this.spec = new TypeParameterSpec (parentSpec, spec.DeclaredPosition, this, spec.SpecialConstraint, spec.Variance, null) {
BaseType = spec.BaseType,
InterfacesDefined = spec.InterfacesDefined,
TypeArguments = spec.TypeArguments
};
}
-
+
#region Properties
public override AttributeTargets AttributeTargets {
if (ec is PointerContainer)
return PointerContainer.MakeType (context.Module, et);
+ if (ec is ReferenceContainer)
+ return ReferenceContainer.MakeType (context.Module, et);
+
throw new NotImplementedException ();
}
foreach (var arg in targs) {
if (arg.HasDynamicElement || arg.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
state |= StateFlags.HasDynamicElement;
- break;
+ }
+
+ if (arg.HasNamedTupleElement) {
+ state |= StateFlags.HasNamedTupleElement;
}
}
}
}
+ public override bool IsTupleType {
+ get {
+ return (open_type.state & StateFlags.Tuple) != 0;
+ }
+ }
+
//
// Types used to inflate the generic type
//
return this;
var mutated = (InflatedTypeSpec) MemberwiseClone ();
+#if DEBUG
+ mutated.ID += 1000000;
+#endif
+
if (decl != DeclaringType) {
// Gets back MethodInfo in case of metaInfo was inflated
//mutated.info = MemberCache.GetMember<TypeSpec> (DeclaringType.GetDefinition (), this).info;
// Some types cannot be used as type arguments
//
if ((bound.Type.Kind == MemberKind.Void && !voidAllowed) || bound.Type.IsPointer || bound.Type.IsSpecialRuntimeType ||
- bound.Type == InternalType.MethodGroup || bound.Type == InternalType.AnonymousMethod || bound.Type == InternalType.VarOutType)
+ bound.Type == InternalType.MethodGroup || bound.Type == InternalType.AnonymousMethod || bound.Type == InternalType.VarOutType ||
+ bound.Type == InternalType.ThrowExpr)
+ return;
+
+ if (bound.Type.IsTupleType && TupleLiteral.ContainsNoTypeElement (bound.Type))
return;
var a = bounds [index];
//
public int ExactInference (TypeSpec u, TypeSpec v)
{
- // If Vi s an array type
+ // If V is an array type
if (v.IsArray) {
if (!u.IsArray)
return 0;
if (u.TypeArguments.Length != v.TypeArguments.Length)
return 0;
-
+
int score = 0;
for (int i = 0; i < ga_v.Length; ++i)
score += ExactInference (ga_u [i], ga_v [i]);