Search in sources :

Example 1 with ThisTypeRef

use of org.eclipse.n4js.ts.typeRefs.ThisTypeRef in project n4js by eclipse.

the class InternalTypeSystem method applyRuleSubtypeTypeTypeRef.

protected Result<Boolean> applyRuleSubtypeTypeTypeRef(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TypeTypeRef left, final TypeTypeRef right) throws RuleFailedException {
    final TypeArgument leftTypeArg = left.getTypeArg();
    final TypeArgument rightTypeArg = right.getTypeArg();
    final boolean leftIsCtorRef = left.isConstructorRef();
    final boolean rightIsCtorRef = right.isConstructorRef();
    final boolean rightHasTypeRef = (rightTypeArg instanceof TypeRef);
    if (((!leftIsCtorRef) && rightIsCtorRef)) {
        /* fail */
        throwForExplicitFail();
    } else {
        if ((rightHasTypeRef && (!rightIsCtorRef))) {
            /* G |- leftTypeArg <: rightTypeArg */
            subtypeInternal(G, _trace_, leftTypeArg, rightTypeArg);
        } else {
            if ((rightHasTypeRef && rightIsCtorRef)) {
                final Type left_staticType = this.typeSystemHelper.getStaticType(G, left);
                final Type right_staticType = this.typeSystemHelper.getStaticType(G, right);
                final boolean leftHasCovariantConstructor = ((left_staticType instanceof TClassifier) && N4JSLanguageUtils.hasCovariantConstructor(((TClassifier) left_staticType)));
                /* !(leftTypeArg instanceof Wildcard || leftTypeArg instanceof ExistentialTypeRef || leftTypeArg instanceof ThisTypeRef) || leftHasCovariantConstructor */
                if (!((!(((leftTypeArg instanceof Wildcard) || (leftTypeArg instanceof ExistentialTypeRef)) || (leftTypeArg instanceof ThisTypeRef))) || leftHasCovariantConstructor)) {
                    sneakyThrowRuleFailedException("!(leftTypeArg instanceof Wildcard || leftTypeArg instanceof ExistentialTypeRef || leftTypeArg instanceof ThisTypeRef) || leftHasCovariantConstructor");
                }
                /* G |- leftTypeArg <: rightTypeArg */
                subtypeInternal(G, _trace_, leftTypeArg, rightTypeArg);
                if (((left_staticType instanceof TypeVariable) || (right_staticType instanceof TypeVariable))) {
                    /* left_staticType === right_staticType */
                    if (!(left_staticType == right_staticType)) {
                        sneakyThrowRuleFailedException("left_staticType === right_staticType");
                    }
                } else {
                    final TMethod leftCtor = this.containerTypesHelper.fromContext(RuleEnvironmentExtensions.getContextResource(G)).findConstructor(((ContainerType<?>) left_staticType));
                    final TMethod rightCtor = this.containerTypesHelper.fromContext(RuleEnvironmentExtensions.getContextResource(G)).findConstructor(((ContainerType<?>) right_staticType));
                    /* leftCtor!==null && rightCtor!==null */
                    if (!((leftCtor != null) && (rightCtor != null))) {
                        sneakyThrowRuleFailedException("leftCtor!==null && rightCtor!==null");
                    }
                    /* G |- leftCtor : var TypeRef leftCtorRef */
                    TypeRef leftCtorRef = null;
                    Result<TypeRef> result = typeInternal(G, _trace_, leftCtor);
                    checkAssignableTo(result.getFirst(), TypeRef.class);
                    leftCtorRef = (TypeRef) result.getFirst();
                    /* G |- rightCtor : var TypeRef rightCtorRef */
                    TypeRef rightCtorRef = null;
                    Result<TypeRef> result_1 = typeInternal(G, _trace_, rightCtor);
                    checkAssignableTo(result_1.getFirst(), TypeRef.class);
                    rightCtorRef = (TypeRef) result_1.getFirst();
                    final RuleEnvironment G_left = RuleEnvironmentExtensions.wrap(G);
                    final RuleEnvironment G_right = RuleEnvironmentExtensions.wrap(G);
                    this.typeSystemHelper.addSubstitutions(G_left, TypeExtensions.ref(left_staticType));
                    RuleEnvironmentExtensions.addThisType(G_left, TypeExtensions.ref(left_staticType));
                    this.typeSystemHelper.addSubstitutions(G_right, TypeExtensions.ref(right_staticType));
                    RuleEnvironmentExtensions.addThisType(G_right, TypeExtensions.ref(right_staticType));
                    /* G_left |- leftCtorRef ~> var TypeRef leftCtorRefSubst */
                    TypeRef leftCtorRefSubst = null;
                    Result<TypeArgument> result_2 = substTypeVariablesInternal(G_left, _trace_, leftCtorRef);
                    checkAssignableTo(result_2.getFirst(), TypeRef.class);
                    leftCtorRefSubst = (TypeRef) result_2.getFirst();
                    /* G_right |- rightCtorRef ~> var TypeRef rightCtorRefSubst */
                    TypeRef rightCtorRefSubst = null;
                    Result<TypeArgument> result_3 = substTypeVariablesInternal(G_right, _trace_, rightCtorRef);
                    checkAssignableTo(result_3.getFirst(), TypeRef.class);
                    rightCtorRefSubst = (TypeRef) result_3.getFirst();
                    /* G |- leftCtorRefSubst <: rightCtorRefSubst */
                    subtypeInternal(G, _trace_, leftCtorRefSubst, rightCtorRefSubst);
                }
            } else {
                /* G |~ leftTypeArg /\ var TypeRef upperBoundLeft */
                TypeRef upperBoundLeft = null;
                Result<TypeRef> result_4 = upperBoundInternal(G, _trace_, leftTypeArg);
                checkAssignableTo(result_4.getFirst(), TypeRef.class);
                upperBoundLeft = (TypeRef) result_4.getFirst();
                /* G |~ leftTypeArg \/ var TypeRef lowerBoundLeft */
                TypeRef lowerBoundLeft = null;
                Result<TypeRef> result_5 = lowerBoundInternal(G, _trace_, leftTypeArg);
                checkAssignableTo(result_5.getFirst(), TypeRef.class);
                lowerBoundLeft = (TypeRef) result_5.getFirst();
                /* G |~ rightTypeArg /\ var TypeRef upperBoundRight */
                TypeRef upperBoundRight = null;
                Result<TypeRef> result_6 = upperBoundInternal(G, _trace_, rightTypeArg);
                checkAssignableTo(result_6.getFirst(), TypeRef.class);
                upperBoundRight = (TypeRef) result_6.getFirst();
                /* G |~ rightTypeArg \/ var TypeRef lowerBoundRight */
                TypeRef lowerBoundRight = null;
                Result<TypeRef> result_7 = lowerBoundInternal(G, _trace_, rightTypeArg);
                checkAssignableTo(result_7.getFirst(), TypeRef.class);
                lowerBoundRight = (TypeRef) result_7.getFirst();
                /* G |- upperBoundLeft <: upperBoundRight */
                subtypeInternal(G, _trace_, upperBoundLeft, upperBoundRight);
                /* G |- lowerBoundRight <: lowerBoundLeft */
                subtypeInternal(G, _trace_, lowerBoundRight, lowerBoundLeft);
            }
        }
    }
    return new Result<Boolean>(true);
}
Also used : TClassifier(org.eclipse.n4js.ts.types.TClassifier) ThisTypeRef(org.eclipse.n4js.ts.typeRefs.ThisTypeRef) BoundThisTypeRef(org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef) TMethod(org.eclipse.n4js.ts.types.TMethod) ThisTypeRef(org.eclipse.n4js.ts.typeRefs.ThisTypeRef) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) BaseTypeRef(org.eclipse.n4js.ts.typeRefs.BaseTypeRef) FunctionTypeRef(org.eclipse.n4js.ts.typeRefs.FunctionTypeRef) ExistentialTypeRef(org.eclipse.n4js.ts.typeRefs.ExistentialTypeRef) BoundThisTypeRef(org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef) StructuralTypeRef(org.eclipse.n4js.ts.typeRefs.StructuralTypeRef) TypeRef(org.eclipse.n4js.ts.typeRefs.TypeRef) TypeTypeRef(org.eclipse.n4js.ts.typeRefs.TypeTypeRef) StaticBaseTypeRef(org.eclipse.n4js.ts.typeRefs.StaticBaseTypeRef) ComposedTypeRef(org.eclipse.n4js.ts.typeRefs.ComposedTypeRef) UnknownTypeRef(org.eclipse.n4js.ts.typeRefs.UnknownTypeRef) ContainerType(org.eclipse.n4js.ts.types.ContainerType) TypeArgument(org.eclipse.n4js.ts.typeRefs.TypeArgument) Result(org.eclipse.xsemantics.runtime.Result) StructuralTypingResult(org.eclipse.n4js.typesystem.StructuralTypingResult) ExistentialTypeRef(org.eclipse.n4js.ts.typeRefs.ExistentialTypeRef) Type(org.eclipse.n4js.ts.types.Type) PrimitiveType(org.eclipse.n4js.ts.types.PrimitiveType) VoidType(org.eclipse.n4js.ts.types.VoidType) AnyType(org.eclipse.n4js.ts.types.AnyType) ModuleNamespaceVirtualType(org.eclipse.n4js.ts.types.ModuleNamespaceVirtualType) NullType(org.eclipse.n4js.ts.types.NullType) UndefinedType(org.eclipse.n4js.ts.types.UndefinedType) ContainerType(org.eclipse.n4js.ts.types.ContainerType) TStructuralType(org.eclipse.n4js.ts.types.TStructuralType) Wildcard(org.eclipse.n4js.ts.typeRefs.Wildcard) TypeVariable(org.eclipse.n4js.ts.types.TypeVariable) RuleEnvironment(org.eclipse.xsemantics.runtime.RuleEnvironment)

Example 2 with ThisTypeRef

use of org.eclipse.n4js.ts.typeRefs.ThisTypeRef in project n4js by eclipse.

the class InternalTypeSystem method applyRuleTypeFormalParameter.

protected Result<TypeRef> applyRuleTypeFormalParameter(final RuleEnvironment G, final RuleApplicationTrace _trace_, final FormalParameter fpar) throws RuleFailedException {
    // output parameter
    TypeRef T = null;
    final TypeRef fparTypeRef = fpar.getDeclaredTypeRef();
    if ((fparTypeRef != null)) {
        if (((fparTypeRef instanceof ThisTypeRefStructural) || ((fparTypeRef instanceof FunctionTypeExpression) && IteratorExtensions.<TFormalParameter>exists(Iterators.<TFormalParameter>filter(((FunctionTypeExpression) fparTypeRef).eAllContents(), TFormalParameter.class), ((Function1<TFormalParameter, Boolean>) (TFormalParameter currFpar) -> {
            TypeRef _typeRef = currFpar.getTypeRef();
            return Boolean.valueOf((_typeRef instanceof ThisTypeRef));
        }))))) {
            T = this.typeSystemHelper.bindAndSubstituteThisTypeRef(G, fparTypeRef, fparTypeRef);
        } else {
            TypeRef _xifexpression = null;
            TFormalParameter _definedTypeElement = null;
            if (fpar != null) {
                _definedTypeElement = fpar.getDefinedTypeElement();
            }
            TypeRef _typeRef = null;
            if (_definedTypeElement != null) {
                _typeRef = _definedTypeElement.getTypeRef();
            }
            boolean _tripleNotEquals = (_typeRef != null);
            if (_tripleNotEquals) {
                _xifexpression = fpar.getDefinedTypeElement().getTypeRef();
            } else {
                _xifexpression = fpar.getDeclaredTypeRef();
            }
            T = _xifexpression;
        }
    } else {
        boolean _isHasInitializerAssignment = fpar.isHasInitializerAssignment();
        if (_isHasInitializerAssignment) {
            Expression _initializer = fpar.getInitializer();
            boolean _tripleNotEquals_1 = (_initializer != null);
            if (_tripleNotEquals_1) {
                /* G |- fpar.initializer : var TypeRef E */
                Expression _initializer_1 = fpar.getInitializer();
                TypeRef E = null;
                Result<TypeRef> result = typeInternal(G, _trace_, _initializer_1);
                checkAssignableTo(result.getFirst(), TypeRef.class);
                E = (TypeRef) result.getFirst();
                T = this.typeSystemHelper.sanitizeTypeOfVariableFieldProperty(G, E);
            } else {
                T = RuleEnvironmentExtensions.anyTypeRef(G);
            }
        } else {
            boolean _enforceDynamicTypes = this.jsVariantHelper.enforceDynamicTypes(fpar);
            if (_enforceDynamicTypes) {
                T = RuleEnvironmentExtensions.anyTypeRefDynamic(G);
            } else {
                /* T = env(G, fpar, TypeRef) or T = G.anyTypeRef */
                {
                    RuleFailedException previousFailure = null;
                    try {
                        T = this.<TypeRef>env(G, fpar, TypeRef.class);
                    } catch (Exception e) {
                        previousFailure = extractRuleFailedException(e);
                        T = RuleEnvironmentExtensions.anyTypeRef(G);
                    }
                }
            }
        }
    }
    T = TypeUtils.wrapIfVariadic(RuleEnvironmentExtensions.getPredefinedTypes(G).builtInTypeScope, T, fpar);
    return new Result<TypeRef>(T);
}
Also used : TFormalParameter(org.eclipse.n4js.ts.types.TFormalParameter) FunctionTypeExpression(org.eclipse.n4js.ts.typeRefs.FunctionTypeExpression) ThisTypeRef(org.eclipse.n4js.ts.typeRefs.ThisTypeRef) BoundThisTypeRef(org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef) BinaryBitwiseExpression(org.eclipse.n4js.n4JS.BinaryBitwiseExpression) AssignmentExpression(org.eclipse.n4js.n4JS.AssignmentExpression) IndexedAccessExpression(org.eclipse.n4js.n4JS.IndexedAccessExpression) UnionTypeExpression(org.eclipse.n4js.ts.typeRefs.UnionTypeExpression) FunctionExpression(org.eclipse.n4js.n4JS.FunctionExpression) PromisifyExpression(org.eclipse.n4js.n4JS.PromisifyExpression) UnaryExpression(org.eclipse.n4js.n4JS.UnaryExpression) ParenExpression(org.eclipse.n4js.n4JS.ParenExpression) ParameterizedCallExpression(org.eclipse.n4js.n4JS.ParameterizedCallExpression) AdditiveExpression(org.eclipse.n4js.n4JS.AdditiveExpression) PostfixExpression(org.eclipse.n4js.n4JS.PostfixExpression) YieldExpression(org.eclipse.n4js.n4JS.YieldExpression) ConditionalExpression(org.eclipse.n4js.n4JS.ConditionalExpression) FunctionTypeExpression(org.eclipse.n4js.ts.typeRefs.FunctionTypeExpression) RelationalExpression(org.eclipse.n4js.n4JS.RelationalExpression) NewExpression(org.eclipse.n4js.n4JS.NewExpression) IntersectionTypeExpression(org.eclipse.n4js.ts.typeRefs.IntersectionTypeExpression) AwaitExpression(org.eclipse.n4js.n4JS.AwaitExpression) CommaExpression(org.eclipse.n4js.n4JS.CommaExpression) Expression(org.eclipse.n4js.n4JS.Expression) CastExpression(org.eclipse.n4js.n4JS.CastExpression) BinaryLogicalExpression(org.eclipse.n4js.n4JS.BinaryLogicalExpression) EqualityExpression(org.eclipse.n4js.n4JS.EqualityExpression) ShiftExpression(org.eclipse.n4js.n4JS.ShiftExpression) ParameterizedPropertyAccessExpression(org.eclipse.n4js.n4JS.ParameterizedPropertyAccessExpression) MultiplicativeExpression(org.eclipse.n4js.n4JS.MultiplicativeExpression) N4ClassExpression(org.eclipse.n4js.n4JS.N4ClassExpression) ThisTypeRef(org.eclipse.n4js.ts.typeRefs.ThisTypeRef) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) BaseTypeRef(org.eclipse.n4js.ts.typeRefs.BaseTypeRef) FunctionTypeRef(org.eclipse.n4js.ts.typeRefs.FunctionTypeRef) ExistentialTypeRef(org.eclipse.n4js.ts.typeRefs.ExistentialTypeRef) BoundThisTypeRef(org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef) StructuralTypeRef(org.eclipse.n4js.ts.typeRefs.StructuralTypeRef) TypeRef(org.eclipse.n4js.ts.typeRefs.TypeRef) TypeTypeRef(org.eclipse.n4js.ts.typeRefs.TypeTypeRef) StaticBaseTypeRef(org.eclipse.n4js.ts.typeRefs.StaticBaseTypeRef) ComposedTypeRef(org.eclipse.n4js.ts.typeRefs.ComposedTypeRef) UnknownTypeRef(org.eclipse.n4js.ts.typeRefs.UnknownTypeRef) ThisTypeRefStructural(org.eclipse.n4js.ts.typeRefs.ThisTypeRefStructural) Function1(org.eclipse.xtext.xbase.lib.Functions.Function1) RuleFailedException(org.eclipse.xsemantics.runtime.RuleFailedException) RuleFailedException(org.eclipse.xsemantics.runtime.RuleFailedException) Result(org.eclipse.xsemantics.runtime.Result) StructuralTypingResult(org.eclipse.n4js.typesystem.StructuralTypingResult)

Example 3 with ThisTypeRef

use of org.eclipse.n4js.ts.typeRefs.ThisTypeRef in project n4js by eclipse.

the class MemberVisibilityChecker method getActualDeclaredReceiverType.

/**
 * Returns the actual receiver type, which usually simply is the declared type of the receiver type. However, in
 * case of classifier references, enums, or structural type references, the actual receiver may be differently
 * computed.
 */
private Type getActualDeclaredReceiverType(EObject context, TypeRef receiverType, ResourceSet resourceSet) {
    if (receiverType instanceof TypeTypeRef) {
        final RuleEnvironment G = RuleEnvironmentExtensions.newRuleEnvironment(context);
        return tsh.getStaticType(G, (TypeTypeRef) receiverType);
    }
    if (receiverType instanceof ThisTypeRef) {
        ThisTypeRef thisTypeRef = (ThisTypeRef) receiverType;
        if (thisTypeRef.isUseSiteStructuralTyping()) {
            FunctionOrFieldAccessor foa = N4JSASTUtils.getContainingFunctionOrAccessor(thisTypeRef);
            N4ClassifierDefinition classifier = EcoreUtil2.getContainerOfType(foa, N4ClassifierDefinition.class);
            return classifier.getDefinedType();
        }
    }
    if (receiverType instanceof FunctionTypeExpression) {
        if (resourceSet == null)
            return null;
        // Change receiverType to implicit super class Function.
        BuiltInTypeScope builtInTypeScope = BuiltInTypeScope.get(resourceSet);
        TObjectPrototype functionType = builtInTypeScope.getFunctionType();
        return functionType;
    }
    return receiverType.getDeclaredType();
}
Also used : ThisTypeRef(org.eclipse.n4js.ts.typeRefs.ThisTypeRef) FunctionTypeExpression(org.eclipse.n4js.ts.typeRefs.FunctionTypeExpression) FunctionOrFieldAccessor(org.eclipse.n4js.n4JS.FunctionOrFieldAccessor) TObjectPrototype(org.eclipse.n4js.ts.types.TObjectPrototype) N4ClassifierDefinition(org.eclipse.n4js.n4JS.N4ClassifierDefinition) TypeTypeRef(org.eclipse.n4js.ts.typeRefs.TypeTypeRef) RuleEnvironment(org.eclipse.xsemantics.runtime.RuleEnvironment) BuiltInTypeScope(org.eclipse.n4js.ts.scoping.builtin.BuiltInTypeScope)

Example 4 with ThisTypeRef

use of org.eclipse.n4js.ts.typeRefs.ThisTypeRef in project n4js by eclipse.

the class InternalTypeSystem method applyRuleSubstTypeVariablesThisTypeRef.

protected Result<TypeArgument> applyRuleSubstTypeVariablesThisTypeRef(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ThisTypeRef thisTypeRef) throws RuleFailedException {
    // output parameter
    ThisTypeRef T = null;
    /* { val BoundThisTypeRef boundRefFromEnv = G.getThisType() as BoundThisTypeRef; if (boundRefFromEnv !== null) { val boundRef = TypeUtils.createBoundThisTypeRef(boundRefFromEnv.actualThisTypeRef); boundRef.setTypingStrategy(thisTypeRef.typingStrategy); TypeUtils.copyTypeModifiers(boundRef, thisTypeRef); T = boundRef; } else { T = thisTypeRef } } or { T = thisTypeRef } */
    {
        RuleFailedException previousFailure = null;
        try {
            TypeRef _thisType = RuleEnvironmentExtensions.getThisType(G);
            final BoundThisTypeRef boundRefFromEnv = ((BoundThisTypeRef) _thisType);
            if ((boundRefFromEnv != null)) {
                final BoundThisTypeRef boundRef = TypeUtils.createBoundThisTypeRef(boundRefFromEnv.getActualThisTypeRef());
                boundRef.setTypingStrategy(thisTypeRef.getTypingStrategy());
                TypeUtils.copyTypeModifiers(boundRef, thisTypeRef);
                T = boundRef;
            } else {
                T = thisTypeRef;
            }
        } catch (Exception e) {
            previousFailure = extractRuleFailedException(e);
            T = thisTypeRef;
        }
    }
    return new Result<TypeArgument>(T);
}
Also used : ThisTypeRef(org.eclipse.n4js.ts.typeRefs.ThisTypeRef) BoundThisTypeRef(org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef) ThisTypeRef(org.eclipse.n4js.ts.typeRefs.ThisTypeRef) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) BaseTypeRef(org.eclipse.n4js.ts.typeRefs.BaseTypeRef) FunctionTypeRef(org.eclipse.n4js.ts.typeRefs.FunctionTypeRef) ExistentialTypeRef(org.eclipse.n4js.ts.typeRefs.ExistentialTypeRef) BoundThisTypeRef(org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef) StructuralTypeRef(org.eclipse.n4js.ts.typeRefs.StructuralTypeRef) TypeRef(org.eclipse.n4js.ts.typeRefs.TypeRef) TypeTypeRef(org.eclipse.n4js.ts.typeRefs.TypeTypeRef) StaticBaseTypeRef(org.eclipse.n4js.ts.typeRefs.StaticBaseTypeRef) ComposedTypeRef(org.eclipse.n4js.ts.typeRefs.ComposedTypeRef) UnknownTypeRef(org.eclipse.n4js.ts.typeRefs.UnknownTypeRef) BoundThisTypeRef(org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef) RuleFailedException(org.eclipse.xsemantics.runtime.RuleFailedException) RuleFailedException(org.eclipse.xsemantics.runtime.RuleFailedException) Result(org.eclipse.xsemantics.runtime.Result) StructuralTypingResult(org.eclipse.n4js.typesystem.StructuralTypingResult)

Example 5 with ThisTypeRef

use of org.eclipse.n4js.ts.typeRefs.ThisTypeRef in project n4js by eclipse.

the class InternalTypeSystem method applyRuleSubstTypeVariablesThisTypeRefStructural.

protected Result<TypeArgument> applyRuleSubstTypeVariablesThisTypeRefStructural(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ThisTypeRefStructural thisTypeRef) throws RuleFailedException {
    // output parameter
    ThisTypeRef T = null;
    /* { val BoundThisTypeRef boundRefFromEnv = G.getThisType() as BoundThisTypeRef; val boundRef = TypeUtils.createBoundThisTypeRefStructural(boundRefFromEnv.actualThisTypeRef, thisTypeRef); TypeUtils.copyTypeModifiers(boundRef, thisTypeRef); T = boundRef; } or { T = thisTypeRef } */
    {
        RuleFailedException previousFailure = null;
        try {
            TypeRef _thisType = RuleEnvironmentExtensions.getThisType(G);
            final BoundThisTypeRef boundRefFromEnv = ((BoundThisTypeRef) _thisType);
            final BoundThisTypeRef boundRef = TypeUtils.createBoundThisTypeRefStructural(boundRefFromEnv.getActualThisTypeRef(), thisTypeRef);
            TypeUtils.copyTypeModifiers(boundRef, thisTypeRef);
            T = boundRef;
        } catch (Exception e) {
            previousFailure = extractRuleFailedException(e);
            T = thisTypeRef;
        }
    }
    return new Result<TypeArgument>(T);
}
Also used : ThisTypeRef(org.eclipse.n4js.ts.typeRefs.ThisTypeRef) BoundThisTypeRef(org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef) ThisTypeRef(org.eclipse.n4js.ts.typeRefs.ThisTypeRef) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) BaseTypeRef(org.eclipse.n4js.ts.typeRefs.BaseTypeRef) FunctionTypeRef(org.eclipse.n4js.ts.typeRefs.FunctionTypeRef) ExistentialTypeRef(org.eclipse.n4js.ts.typeRefs.ExistentialTypeRef) BoundThisTypeRef(org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef) StructuralTypeRef(org.eclipse.n4js.ts.typeRefs.StructuralTypeRef) TypeRef(org.eclipse.n4js.ts.typeRefs.TypeRef) TypeTypeRef(org.eclipse.n4js.ts.typeRefs.TypeTypeRef) StaticBaseTypeRef(org.eclipse.n4js.ts.typeRefs.StaticBaseTypeRef) ComposedTypeRef(org.eclipse.n4js.ts.typeRefs.ComposedTypeRef) UnknownTypeRef(org.eclipse.n4js.ts.typeRefs.UnknownTypeRef) BoundThisTypeRef(org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef) RuleFailedException(org.eclipse.xsemantics.runtime.RuleFailedException) RuleFailedException(org.eclipse.xsemantics.runtime.RuleFailedException) Result(org.eclipse.xsemantics.runtime.Result) StructuralTypingResult(org.eclipse.n4js.typesystem.StructuralTypingResult)

Aggregations

ThisTypeRef (org.eclipse.n4js.ts.typeRefs.ThisTypeRef)6 TypeTypeRef (org.eclipse.n4js.ts.typeRefs.TypeTypeRef)6 BaseTypeRef (org.eclipse.n4js.ts.typeRefs.BaseTypeRef)5 BoundThisTypeRef (org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef)5 ComposedTypeRef (org.eclipse.n4js.ts.typeRefs.ComposedTypeRef)5 ExistentialTypeRef (org.eclipse.n4js.ts.typeRefs.ExistentialTypeRef)5 FunctionTypeRef (org.eclipse.n4js.ts.typeRefs.FunctionTypeRef)5 ParameterizedTypeRef (org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef)5 StaticBaseTypeRef (org.eclipse.n4js.ts.typeRefs.StaticBaseTypeRef)5 StructuralTypeRef (org.eclipse.n4js.ts.typeRefs.StructuralTypeRef)5 TypeRef (org.eclipse.n4js.ts.typeRefs.TypeRef)5 UnknownTypeRef (org.eclipse.n4js.ts.typeRefs.UnknownTypeRef)5 StructuralTypingResult (org.eclipse.n4js.typesystem.StructuralTypingResult)5 Result (org.eclipse.xsemantics.runtime.Result)5 FunctionTypeExpression (org.eclipse.n4js.ts.typeRefs.FunctionTypeExpression)3 RuleFailedException (org.eclipse.xsemantics.runtime.RuleFailedException)3 AdditiveExpression (org.eclipse.n4js.n4JS.AdditiveExpression)2 AssignmentExpression (org.eclipse.n4js.n4JS.AssignmentExpression)2 AwaitExpression (org.eclipse.n4js.n4JS.AwaitExpression)2 BinaryBitwiseExpression (org.eclipse.n4js.n4JS.BinaryBitwiseExpression)2