public override object Exec(TypeVariable caller, object arg)
 {
     if (caller.Substitution != null)
     {
         DynVarOptions.Instance.AssignDynamism(caller.Substitution, caller.IsDynamic);
         return(caller.Substitution.AcceptOperation(this, arg));
     }
     if (this.methodAnalyzed != null)
     {
         // * A method invocation constraint is added to the method analyzed
         ParenthesisConstraint constraint = new ParenthesisConstraint(caller, this.actualImplicitObject, this.arguments, this.activeSortOfUnification, this.location);
         this.methodAnalyzed.AddConstraint(constraint);
         return(constraint.ReturnType);
     }
     return(ReportError(caller));
 }
        public override object Exec(UnionType caller, object arg)
        {
            // * If all the types in typeset generate a constraint, we simply generate one constraint using the whole union type
            if (caller.IsFreshVariable() && this.methodAnalyzed != null)
            {
                // * A constraint is added to the method analyzed
                ParenthesisConstraint constraint = new ParenthesisConstraint(caller, this.actualImplicitObject, this.arguments, this.activeSortOfUnification, this.location);
                this.methodAnalyzed.AddConstraint(constraint);
                return(constraint.ReturnType);
            }
            TypeExpression returnType = null;

            foreach (TypeExpression type in caller.TypeSet)
            {
                TypeExpression ret = (TypeExpression)type.AcceptOperation(this, arg);
                if (ret == null && caller.IsDynamic)
                {
                    return(null);
                }
                returnType = UnionType.collect(returnType, ret);
            }
            return(returnType);
        }