The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
MethodType.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: MethodType.cs //
6 // Authors: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Francisco Ortin - francisco.ortin@gmail.com //
8 // Description: //
9 // Represents a method type. //
10 // Inheritance: MemberType. //
11 // Implements Composite pattern [Composite]. //
12 // Implements Observer pattern [Subject and Observer] //
13 // -------------------------------------------------------------------------- //
14 // Create date: 15-10-2006 //
15 // Modification date: 03-04-2007 //
17 //visto
18 using System;
19 using System.Collections.Generic;
20 using System.Text;
21 using System.Text.RegularExpressions;
22 
23 using AST;
24 using ErrorManagement;
25 using TypeSystem.Constraints;
26 using Tools;
27 using TypeSystem.Operations;
28 
29 namespace TypeSystem {
38  #region Fields
39 
43  private TypeExpression ret;
44 
48  private List<TypeExpression> paramList = new List<TypeExpression>();
49 
53  private AccessModifier memberInfo;
54 
58  private ConstraintList constraints = new ConstraintList();
59 
63  private MethodDeclaration astNode;
64 
68  private int numberFreeVariablesCache;
69 
73  private bool validNumberFreeVariables;
74 
79  private bool isTypeInferred = false;
80 
88  private IDictionary<MethodType, TypeVariable> observerCollection;
89 
90  #endregion
91 
92  #region Properties
93 
94  public TypeExpression getParam (int index) {
95  return paramList[index];
96  }
101  get { return this.ret; }
102  set {
103  this.ret = value;
104  this.ValidTypeExpression = this.memberInfo.Class.ValidTypeExpression = false;
105  }
106  }
107 
111  public int ParameterListCount {
112  get { return this.paramList.Count; }
113  }
114 
119  get { return this.memberInfo; }
120  set {
121  if (this.memberInfo == null) {
122  this.memberInfo = value;
123  }
124  else
125  ErrorManager.Instance.NotifyError(new ClassTypeInfoError(this.memberInfo.MemberIdentifier, this.memberInfo.Class.FullName, value.Class.FullName));
126  }
127  }
128 
133  get { return this.constraints; }
134  }
135 
140  get { return this.astNode; }
141  set { this.astNode = value; }
142  }
143 
147  internal override bool ValidTypeExpression {
148  set {
149  validTypeExpression = value;
150  if (!value) {
151  // * Updates the full name
152  this.BuildFullName();
153  // * Recalculates its class type expression
154  if (this.MemberInfo != null && this.MemberInfo.Class != null)
155  this.MemberInfo.Class.ValidTypeExpression = false;
156  }
157  }
158  }
159 
164  public bool IsTypeInferred {
165  get { return this.isTypeInferred; }
166  }
167  #endregion
168 
169  #region Constructor
170 
176  this.ret = ret;
177  this.BuildFullName();
178  }
179  #endregion
180 
181  #region Dispatcher
182  public override object AcceptOperation(TypeSystemOperation op, object arg) { return op.Exec(this, arg); }
183  #endregion
184 
185  #region AddParameter()
186  public void AddParameter(TypeExpression paramType) {
191  this.paramList.Add(paramType);
192  }
193  #endregion
194 
195  #region GetParameter()
196 
202  public TypeExpression GetParameter(int index) {
203  if ((index >= 0) && (index < this.paramList.Count))
204  return this.paramList[index];
205  return null;
206  }
207 
208  #endregion
209 
210  #region AddConstraint()
211  public void AddConstraint(Constraint constraint) {
216  //if (constraint is CloneConstraint)
217  //{
218  // CloneConstraint cloneConstraint = ((CloneConstraint)constraint);
219  // foreach (var addedContraint in this.constraints.Constraints)
220  // {
221  // if (addedContraint is CloneConstraint)
222  // {
223  // CloneConstraint addedCloneConstraint = ((CloneConstraint)addedContraint);
224  // if (addedCloneConstraint.ReturnType.Equals(cloneConstraint.FirstOperand))
225  // {
226  // if (addedCloneConstraint.FirstOperand is TypeVariable && ((TypeVariable)addedCloneConstraint.FirstOperand).Substitution == null)
227  // {
228  // this.constraints.Add(new CloneConstraint(addedCloneConstraint.FirstOperand));
229  // return;
230  // }
231  // }
232  // }
233 
234  // }
235  //}
236  this.constraints.Add(constraint);
237  }
238  #endregion
239 
240  #region AddConstraint()
241  public void RemoveConstraint(int index) {
246  this.constraints.Constraints.RemoveAt(index);
247  }
248  #endregion
249 
250  #region BuildTypeExpressionString()
251 
255  public override string BuildTypeExpressionString(int depthLevel) {
256  if (this.ValidTypeExpression) return this.typeExpression;
257  if (depthLevel <= 0) return this.FullName;
258 
259  StringBuilder tE = new StringBuilder();
260  // tE: Method(IdClass, IdMethod, mods, params -> ret)
261  if (this.MemberInfo != null) {
262  tE.AppendFormat("Method({0}, {1},", this.MemberInfo.Class.FullName, this.MemberInfo.MemberIdentifier);
263  // modifiers
264  if (this.MemberInfo.Modifiers.Count != 0) {
265  for (int i = 0; i < this.MemberInfo.Modifiers.Count - 1; i++)
266  tE.AppendFormat(" {0} x", this.MemberInfo.Modifiers[i]);
267  tE.AppendFormat(" {0}", this.MemberInfo.Modifiers[this.MemberInfo.Modifiers.Count - 1]);
268  }
269  tE.Append(", ");
270  }
271 
272  // type
273  tE.Append("(");
274  if (this.paramList.Count > 0)
275  for (int i = 0; i < this.paramList.Count; i++) {
276  tE.AppendFormat("{0}", this.paramList[i].BuildTypeExpressionString(depthLevel - 1));
277  if (i < this.paramList.Count - 1)
278  tE.Append(" x ");
279  }
280  else
281  tE.Append("void");
282  tE.Append(")->");
283  if (this.ret != null)
284  tE.Append(this.ret.BuildTypeExpressionString(depthLevel - 1));
285  else
286  tE.Append("void");
287  // * Constraints
288  tE.Append(", ");
289  for (int i = 0; i < this.Constraints.Count; i++) {
290  tE.Append(this.Constraints[i].ToString());
291  if (i < this.Constraints.Count - 1)
292  tE.Append(" x ");
293  }
294  tE.Append(")");
295  this.ValidTypeExpression = true;
296  return this.typeExpression = tE.ToString();
297  }
298  #endregion
299 
300  #region BuildFullName()
301  public override void BuildFullName() {
305  StringBuilder fN = new StringBuilder();
306  if (this.memberInfo != null)
307  fN.AppendFormat("{0}.{1}:", this.MemberInfo.Class.FullName, this.MemberInfo.MemberIdentifier);
308  fN.Append("(");
309  if (this.paramList.Count > 0)
310  for (int i = 0; i < this.paramList.Count; i++) {
311  fN.AppendFormat("{0}", this.paramList[i].FullName);
312  if (i < this.paramList.Count - 1)
313  fN.Append(" x ");
314  }
315  else fN.Append("void");
316  fN.Append(")->");
317  if (this.ret != null)
318  fN.Append(this.ret.FullName);
319  else fN.Append("void");
320  fN.Append(")");
321  this.fullName = fN.ToString();
322  }
323  #endregion
324 
325  // WriteType inference
326 
327  #region Parenthesis() ANULADA
328 
341  //public override TypeExpression Parenthesis(TypeExpression actualImplicitObject, TypeExpression[] arguments, MethodType methodAnalyzed,
342  // SortOfUnification activeSortOfUnification, Location loc) {
343  // // * Quits if there's some error in the arguments
344  // if (arguments == null)
345  // return null;
346 
347  // // * An instance method cannot be call from a static method without using an object
348  // if ((!this.MemberInfo.Modifiers.Contains(Modifier.Static)) && methodAnalyzed != null &&
349  // methodAnalyzed.MemberInfo.Modifiers.Contains(Modifier.Static) && actualImplicitObject == null) {
350  // ErrorManager.Instance.NotifyError(new InstanceMethodCallFromStaticMethodError(this.FullName, methodAnalyzed.FullName, loc));
351  // return null;
352  // }
353 
354  // // * Is Unification necessary?
355  // if (this.MemberInfo.Class.HasTypeVariables() || this.HasTypeVariables())
356  // // * We infer the return type
357  // return methodCall(actualImplicitObject, this, arguments, methodAnalyzed, activeSortOfUnification, loc);
358 
359  // // * Otherwise...
360  // // Check the argument number
361  // if (arguments.GetLength(0) != this.ParameterListCount) {
362  // ErrorManager.Instance.NotifyError(new ArgumentNumberError(this.MemberInfo.MemberIdentifier, arguments.GetLength(0), loc));
363  // return null;
364  // }
365  // // Check the argument type
366  // for (int i = 0; i < this.ParameterListCount; i++)
367  // arguments[i].Promotion(this.paramList[i], methodAnalyzed, loc);
368  // // * Returns the return type
369  // return this.ret;
370  //}
371 
372  #endregion
373 
374  #region Equivalent()
375  //public override bool Equivalent(TypeExpression type) {
381  // if (this == type)
382  // return true;
383  // TypeVariable typeVariable = type as TypeVariable;
384  // if (typeVariable != null)
385  // return typeVariable.Equivalent(this);
386  // MethodType method = type as MethodType;
387  // // * It must be a method
388  // if (method == null)
389  // return false;
390  // // * Same name
391  // if (!this.memberInfo.MemberIdentifier.Equals(method.memberInfo.MemberIdentifier))
392  // return false;
393  // // * Same class
394  // if (!this.MemberInfo.Class.Equivalent(method.MemberInfo.Class))
395  // return false;
396  // // * Same signature
397  // if (this.ParameterListCount != method.ParameterListCount)
398  // return false;
399  // for (int i = 0; i < this.ParameterListCount; i++)
400  // if (!this.GetParameter(i).Equivalent(method.GetParameter(i)))
401  // return false;
402  // return true;
403  //}
404  #endregion
405 
406 
407  #region Promotion (Overloaded)
408 
417  public int Promotion(TypeExpression[] arguments, Location location) {
418  int promotion = 0;
419  int aux;
420 
421  // Has been any error in the arguments?
422  if (arguments == null)
423  return this.paramList.Count == 0 ? 0 : -1;
424 
425  // Check the argument number
426  if (arguments.GetLength(0) != this.ParameterListCount)
427  return -1;
428 
429  // Check the argument type
430  for (int i = 0; i < this.ParameterListCount; i++) {
431  if ((aux = (int)arguments[i].AcceptOperation( new PromotionLevelOperation(this.paramList[i]), null)) != -1)
432  promotion += aux;
433  else
434  return -1;
435  }
436  return promotion;
437  }
438 
439  #endregion
440 
441  #region EqualsForOverload() NO ANULADA
442  public virtual bool EqualsForOverload(TypeExpression typeExpression) {
448  return (bool) this.AcceptOperation(new EqualsForOverloadOperation(typeExpression), null);
449  }
450  #endregion
451 
452  #region GetNumberFreeVariables()
453  public int GetNumberFreeVariables() {
459  if (this.validNumberFreeVariables)
460  return this.numberFreeVariablesCache;
461  int number = 0;
462  foreach (TypeExpression type in this.paramList)
463  if (type.HasTypeVariables())
464  number++;
465  this.validNumberFreeVariables = true;
466  return this.numberFreeVariablesCache = number++;
467  }
468  #endregion
469 
470  // WriteType unification
471 
472  #region Unify
473  public override bool Unify(TypeExpression te, SortOfUnification unification, IList<Pair<TypeExpression, TypeExpression>> previouslyUnified) {
481  MethodType mt = te as MethodType;
482  if (mt != null) {
483  if (mt.ParameterListCount != this.ParameterListCount)
484  return false;
485  bool success = true;
486  for (int i = 0; i < this.ParameterListCount; i++)
487  if (!this.paramList[i].Unify(mt.GetParameter(i), unification, previouslyUnified)) {
488  success = false;
489  break;
490  }
491  if (success)
492  success = this.Return.Unify(mt.Return, unification, previouslyUnified);
493  // * Clears the type expression cache
494  this.ValidTypeExpression = false;
495  te.ValidTypeExpression = false;
496  return success;
497  }
498  if (te is TypeVariable && unification != SortOfUnification.Incremental)
499  // * No incremental unification is commutative
500  return te.Unify(this, unification, previouslyUnified);
501  return false;
502  }
503  #endregion
504 
505 
506  #region HasTypeVariables()
507  public override bool HasTypeVariables() {
513  if (this.validHasTypeVariables)
514  return this.hasTypeVariablesCache;
515  bool toReturn = this.ret.HasTypeVariables();
516  if (!toReturn)
517  foreach (TypeExpression type in this.paramList)
518  if (type.HasTypeVariables()) {
519  toReturn = true;
520  break;
521  }
522  this.validHasTypeVariables = true;
523  return this.hasTypeVariablesCache = toReturn;
524  }
525  #endregion
526 
527  #region CloneMethodType()
528  public MethodType CloneMethodType(IDictionary<TypeVariable, TypeVariable> typeVariableMappings) {
538  // * We clone the members of the MethodType
539  MethodType methodType = new MethodType(null);
540  List<TypeExpression> oldParameterList = this.paramList;
541  methodType.paramList = new List<TypeExpression>();
542  // * We must create new type variables for parameters
543  IList<EquivalenceClass> equivalenceClasses = new List<EquivalenceClass>();
544  for (int i = 0; i < this.paramList.Count; i++)
545  // * Every type variable is cloned to a new one, adding both to typesVariables,
546  // inserting its equivalence classes in the equivalenceClasses parameter and updating the
547  // typeVariableMappings dictionary (<oldvariable,newVariable>
548  methodType.paramList.Add(oldParameterList[i].CloneTypeVariables(typeVariableMappings, equivalenceClasses, new List<ClassType>()));
549  // * The same for the returned value
550  methodType.ret = this.ret.CloneTypeVariables(typeVariableMappings, equivalenceClasses, new List<ClassType>());
551  // * Member info (access modifier)
552  AccessModifier accessModifier = (AccessModifier)this.MemberInfo.Clone();
553  accessModifier.Type = methodType;
554  methodType.MemberInfo = accessModifier;
555  // * We also have to clone the constraints
556  methodType.constraints = (ConstraintList)this.constraints.CloneTypeVariables(typeVariableMappings, equivalenceClasses);
557  // * For each equivalence class we create a new one,
558  // substituting the old type variables for the new ones
559  // * The substitution is not altered
560  // * Since equivalence classes and type variables have a bidirectional association,
561  // the new equivalence classes will make type variables update their new equivalence classes
562  foreach (EquivalenceClass equivalenceClass in equivalenceClasses)
563  equivalenceClass.UpdateEquivalenceClass(typeVariableMappings);
564  methodType.ValidTypeExpression = false;
565  // * The new method type is returned
566  return methodType;
567  }
568  #endregion
569 
570  // SSA
571 
572  #region Clone()
573  internal override TypeExpression Clone(IDictionary<int, TypeVariable> clonedTypeVariables, IList<EquivalenceClass> equivalenceClasses, MethodType methodAnalyzed) {
584  // * Methods are not cloned
585  return this;
586  }
587  #endregion
588 
589  // Loop Detection
590 
591  // Helper Methods
592 
593  #region methodCall()
594 
610  public static TypeExpression methodCall(TypeExpression actualImplicitObject, MethodType formalMethod, TypeExpression[] args,
611  MethodType methodAnalyzed, SortOfUnification activeSortOfUnification, Location location) {
612  UserType userType = formalMethod.MemberInfo.Class;
613  MethodType actualMethod = null;
614  // * We must create a new type with type variables for the object's attributes (the formal implicit object)
615  IDictionary<TypeVariable, TypeVariable> typeVariableMappings = new Dictionary<TypeVariable, TypeVariable>();
616 
617  // * If the method is an instance one and the actual object is not this, we create a new implicit object to unify
618  if (!formalMethod.MemberInfo.hasModifier(Modifier.Static) && actualImplicitObject != null && actualImplicitObject != methodAnalyzed.memberInfo.Class) {
619  // * Unifies the implicit objects (actual and formal)
620  UserType formalImplicitObject = (UserType)userType.CloneType(typeVariableMappings);
621  if (!actualImplicitObject.Unify(formalImplicitObject, SortOfUnification.Equivalent, new List<Pair<TypeExpression, TypeExpression>>()))
622  // * If the formal implicit object already has substitution (fields declararion with assignments), we override it with a union type
623  formalImplicitObject.Unify(actualImplicitObject, SortOfUnification.Override, new List<Pair<TypeExpression, TypeExpression>>());
624  actualImplicitObject.ValidTypeExpression = false;
625  }
626 
627  // * If "this" is the actual implicit object, the return type is the original return type of the method
628  TypeExpression originalReturnType = formalMethod.Return;
629 
630  if (formalMethod.HasTypeVariables() || formalMethod.Constraints.Count > 0)
631  // * We must also generate a method with fresh variables (formal method)
632  // when it has parameters with type variables or constraints
633  formalMethod = formalMethod.CloneMethodType(typeVariableMappings);
634 
635  // * If the method has type variables...
636  if (formalMethod.HasTypeVariables()) {
637  // * We create the actual method:
638  // 1.- The actual return type
639  TypeVariable actualReturnType = TypeVariable.NewTypeVariable;
640  // 2.- The actual method
641  actualMethod = new MethodType(actualReturnType);
642  // 3.- The actual parameters
643  foreach (TypeExpression arg in args)
644  actualMethod.AddParameter(arg);
645 
646  // * Unifies both methods
647  if (!actualMethod.Unify(formalMethod, SortOfUnification.Equivalent, new List<Pair<TypeExpression, TypeExpression>>())) {
648  ErrorManager.Instance.NotifyError(new UnificationError(actualMethod.FullName, location));
649  return null;
650  }
651  }
652  // * Otherwise, arguments promotion must be checked
653  else {
654  if (args.Length != formalMethod.ParameterListCount) {
655  ErrorManager.Instance.NotifyError(new ArgumentNumberError(formalMethod.FullName, args.Length, location));
656  return null;
657  }
658  for (int i = 0; i < args.Length; i++)
659  if (args[i].AcceptOperation(PromotionOperation.Create(formalMethod.paramList[i], methodAnalyzed, location), null) == null)
660  return null;
661  }
662 
663  // * Method constraints satisfaction
664  if (formalMethod.Constraints.Count > 0)
665  formalMethod.Constraints.Check(methodAnalyzed, actualImplicitObject, true, activeSortOfUnification, location);
666 
667 
668  // * The returned type is the the actual method if there has been a unification and
669  // in case the method is a instance method, a concrete object has been used (not this) or
670  // a different implicit object (the this reference is changed in the SSA algorithm)
671  if (actualMethod != null && (formalMethod.MemberInfo.hasModifier(Modifier.Static) ||
672  ClassType.IsConcreteType(actualImplicitObject) != null ||
673  actualImplicitObject != formalMethod.MemberInfo.Class)) {
674  TypeVariable returnType = (TypeVariable)actualMethod.Return;
675  if (returnType.Substitution != null)
676  return returnType.EquivalenceClass.Substitution;
677  return returnType;
678  }
679  // * The original returned type if there has been no unification or the implicit object is "this"
680  return originalReturnType;
681  }
682 
683  #endregion
684 
685  #region AddInferredTypeObserver()
686 
692  public void addInferredTypeObserver(MethodType method, TypeVariable returnType) {
693  if (this.observerCollection == null)
694  this.observerCollection = new Dictionary<MethodType, TypeVariable>();
695  this.observerCollection[method] = returnType;
696  }
697 
698  #endregion
699 
700  #region TypeInferred()
701 
705  public void TypeInferred() {
706  this.isTypeInferred = true;
707  // * Iterates through all the observers, updating the new type inferred
708  if (this.observerCollection != null) {
709  foreach (KeyValuePair<MethodType, TypeVariable> pair in this.observerCollection) {
710  // * Once the type is inferred, we add it to the caller (the observer)
711  pair.Key.Return = UnionType.collect(pair.Key.Return, this.Return);
712  // * The type variable used for the return type in the method call is unified
713  // with the actual type (once inferred), excluding itself
714  this.Return.Remove(pair.Value);
715  //if (pair.Key.Return is TypeVariable)
716  // this.Return.Remove((TypeVariable)pair.Key.Return);
717  pair.Value.Unify(this.Return, SortOfUnification.Equivalent, new List<Pair<TypeExpression, TypeExpression>>());
718  }
719  }
720  }
721 
722  #endregion
723 
724  #region IsValueType()
725 
730  public override bool IsValueType() {
731  return this.ret.IsValueType();
732  }
733 
734  #endregion
735 
736  }
737 }
bool IsTypeInferred
Its true when the type of the method has been completely inferred. Used to detect loops in the abstra...
Definition: MethodType.cs:164
Its operation AcceptOperation() returns an integer value that indicates a promotion level between two...
static TypeVariable NewTypeVariable
Gets a new identify to the variable type
Definition: TypeVariable.cs:67
override void BuildFullName()
Creates/Updates the full name of the type expression
Definition: MethodType.cs:304
MethodDeclaration ASTNode
The AST node set by the VisitorTypeDefinition and used in the VisitorTypeInferece for abstract interp...
Definition: MethodType.cs:139
override bool Unify(TypeExpression te, SortOfUnification unification, IList< Pair< TypeExpression, TypeExpression >> previouslyUnified)
This method unifies two type expressions (this and te)
Definition: MethodType.cs:480
Represents a error produced when a MethodType has class information and tries to assign other class i...
bool validHasTypeVariables
To cache the result of the HasTypeVariables method
This class encapsulates a location in a specific file. Implements an Inmutable pattern. So it can be used in any context, that is his internal fields never change.
Definition: Location.cs:24
This class represent the entry wnen sending a message to an operation object derived from TypeExpress...
int GetNumberFreeVariables()
To know the number of parameters that has type variables. This is used for overload resolution...
Definition: MethodType.cs:458
override string BuildTypeExpressionString(int depthLevel)
Creates the type expression and the full name string.
Definition: MethodType.cs:255
Implemeents a double dispatcher pattern Role:
string MemberIdentifier
Gets the attribute name
void RemoveConstraint(int index)
Removes a constraint to the method.
Definition: MethodType.cs:245
Represents a error produced when the argument and parameter number is different.
bool hasModifier(Modifier mod)
To know if a modifier is supported
AccessModifier MemberInfo
Gets or sets the attribute information of method type
Definition: MethodType.cs:118
bool validTypeExpression
To implement a type expression cache
Abstract class that represents all different types.
Represents a generic type expression
Definition: TypeVariable.cs:36
static PromotionOperation Create(TypeExpression type, MethodType methodAnalyzed, Location location)
System.Text.StringBuilder StringBuilder
Definition: CSharpParser.cs:4
virtual string FullName
Gets the full name of the type Note: WriteType expression is the longest recursive representation of ...
int ParameterListCount
Gets the number of parameters
Definition: MethodType.cs:111
void AddConstraint(Constraint constraint)
Adds a new constraint to the method.
Definition: MethodType.cs:215
TypeExpression Return
Gets type expression method return
Definition: MethodType.cs:100
override bool HasTypeVariables()
To know if the type expression has some type variables and requieres unification The default implemen...
Definition: MethodType.cs:512
Encapsulates a declaration of a concrete method.
int Promotion(TypeExpression[] arguments, Location location)
Gets the promotion value of the method.
Definition: MethodType.cs:417
void addInferredTypeObserver(MethodType method, TypeVariable returnType)
Adds a new observer that listens to the event of inferred types
Definition: MethodType.cs:692
override bool IsValueType()
True if type expression is a ValueType. Otherwise, false.
Definition: MethodType.cs:730
MethodType CloneMethodType(IDictionary< TypeVariable, TypeVariable > typeVariableMappings)
This method returns a new method type, creating new type variables for each parametern and the return...
Definition: MethodType.cs:537
virtual bool EqualsForOverload(TypeExpression typeExpression)
Used to not repeat methods in overload
Definition: MethodType.cs:447
ConstraintList Constraints
A set of constraints to be satisfied
Definition: MethodType.cs:132
Modifier
Indicates differents modifiers to use in class (only public, internal or static), fields or methods...
override object AcceptOperation(TypeSystemOperation op, object arg)
Definition: MethodType.cs:182
static TypeExpression methodCall(TypeExpression actualImplicitObject, MethodType formalMethod, TypeExpression[] args, MethodType methodAnalyzed, SortOfUnification activeSortOfUnification, Location location)
This method does the type inference in a method call including unification. It requires that a) the m...
Definition: MethodType.cs:610
string typeExpression
Represents the type by a debug string Note: WriteType expression is the longest recursive representat...
UserType Class
Gets or sets the class type reference
Representa a method type.
Definition: MethodType.cs:37
override Constraint CloneTypeVariables(IDictionary< TypeVariable, TypeVariable > typeVariableMappings, IList< EquivalenceClass > equivalenceClasses)
Method that clones each type variable of a constraint. Equivalence classes are not cloned (but includ...
List< Modifier > Modifiers
Gets the modifiers of the element
TypeExpression Substitution
Gets the substitution; null if it does not exist
Association Class between ClassType and MethodType (or Fields). Represents the access modifier inform...
MethodType(TypeExpression ret)
Constructor of MethodType
Definition: MethodType.cs:175
void TypeInferred()
This method is used to control loops (recursion)
Definition: MethodType.cs:705
Represents a error produced when the attribute identifier is not defined.
abstract bool Unify(TypeExpression te, SortOfUnification unification, IList< Pair< TypeExpression, TypeExpression >> previouslyUnified)
Requires the implicit object to be a subtype of the type parameter
TypeExpression GetParameter(int index)
Gets the type expression of the specific parameter
Definition: MethodType.cs:202
Represents a class or interface type.
Definition: UserType.cs:31
int Count
The number of constraints
TypeExpression getParam(int index)
Definition: MethodType.cs:94
void AddParameter(TypeExpression paramType)
Adds a new parameter type.
Definition: MethodType.cs:190
virtual TypeExpression CloneType(IDictionary< TypeVariable, TypeVariable > typeVariableMappings)
This method creates a new type, creating new type variables for type expression. It these type variab...
Representa a class attribute (fields or methods).
Definition: IMemberType.cs:32