Search in sources :

Example 26 with RuleEnvironment

use of org.eclipse.xsemantics.runtime.RuleEnvironment in project n4js by eclipse.

the class Reducer method reduceParameterizedTypeRefNominal.

/**
 * Reduction for parameterized type references according to nominal subtyping rules.
 * <p>
 * NOTE: 'left' might be a structural type reference iff variance == CO / 'right' might be structural (iff variance
 * == CONTRA) but that is irrelevant and the reduction must still follow nominal subtyping rules (because the RHS of
 * the subtype relation determines whether to use nominal or structural rules).
 */
private boolean reduceParameterizedTypeRefNominal(ParameterizedTypeRef left, ParameterizedTypeRef right, Variance variance) {
    // e.g., ⟨ Iterable3<int,string,int> :> Array<α> ⟩ should be reduced to ⟨ int >: α ⟩ and ⟨ string >: α ⟩
    if ((variance == CO && isSpecialCaseOfArraySubtypeIterableN(left, right)) || (variance == CONTRA && isSpecialCaseOfArraySubtypeIterableN(right, left))) {
        final List<TypeArgument> typeArgsOfArray = variance == CO ? left.getTypeArgs() : right.getTypeArgs();
        final List<TypeArgument> typeArgsOfIterableN = variance == CO ? right.getTypeArgs() : left.getTypeArgs();
        final List<TypeVariable> typeParamsOfIterableN = variance == CO ? right.getDeclaredType().getTypeVars() : left.getDeclaredType().getTypeVars();
        final TypeArgument singleTypeArgOfArray = !typeArgsOfArray.isEmpty() ? typeArgsOfArray.get(0) : null;
        boolean wasAdded = false;
        final int len = Math.min(typeArgsOfIterableN.size(), typeParamsOfIterableN.size());
        for (int idx = 0; idx < len; idx++) {
            TypeArgument currTypeArgOfIterableN = typeArgsOfIterableN.get(idx);
            TypeVariable curTypeParamOfIterableN = typeParamsOfIterableN.get(idx);
            wasAdded |= reduceConstraintForTypeArgumentPair(currTypeArgOfIterableN, curTypeParamOfIterableN, singleTypeArgOfArray);
        }
        return wasAdded;
    }
    // standard cases:
    final TypeRef leftRaw = TypeUtils.createTypeRef(left.getDeclaredType());
    // note: enforcing nominal here!
    final TypeRef rightRaw = TypeUtils.createTypeRef(right.getDeclaredType());
    if ((variance == CO && !ts.subtypeSucceeded(G, leftRaw, rightRaw)) || (variance == CONTRA && !ts.subtypeSucceeded(G, rightRaw, leftRaw)) || (variance == INV && !ts.equaltypeSucceeded(G, leftRaw, rightRaw))) {
        return giveUp(left, right, variance);
    }
    // IV <-> string
    if (variance == CO) {
        // normalize ⟨ B <: A ⟩ to ⟨ A :> B ⟩ to make sure the (raw) subtype is on the right-hand side
        final ParameterizedTypeRef tmp = left;
        left = right;
        right = tmp;
        variance = CONTRA;
    }
    boolean wasAdded = false;
    final RuleEnvironment Gx = RuleEnvironmentExtensions.newRuleEnvironment(G);
    tsh.addSubstitutions(Gx, right);
    final Type leftType = left.getDeclaredType();
    final List<TypeArgument> leftArgs = left.getTypeArgs();
    final List<TypeVariable> leftParams = leftType.getTypeVars();
    final int len = Math.min(leftArgs.size(), leftParams.size());
    for (int idx = 0; idx < len; ++idx) {
        final TypeArgument leftArg = leftArgs.get(idx);
        final TypeVariable leftParam = leftParams.get(idx);
        if (RuleEnvironmentExtensions.hasSubstitutionFor(Gx, leftParam)) {
            final TypeArgument leftParamSubst = ts.substTypeVariables(Gx, TypeUtils.createTypeRef(leftParam)).getValue();
            wasAdded |= reduceConstraintForTypeArgumentPair(leftArg, leftParam, leftParamSubst);
        }
    }
    return wasAdded;
}
Also used : ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) ContainerType(org.eclipse.n4js.ts.types.ContainerType) Type(org.eclipse.n4js.ts.types.Type) PrimitiveType(org.eclipse.n4js.ts.types.PrimitiveType) TypeVariable(org.eclipse.n4js.ts.types.TypeVariable) ExistentialTypeRef(org.eclipse.n4js.ts.typeRefs.ExistentialTypeRef) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) TypeRef(org.eclipse.n4js.ts.typeRefs.TypeRef) TypeTypeRef(org.eclipse.n4js.ts.typeRefs.TypeTypeRef) ComposedTypeRef(org.eclipse.n4js.ts.typeRefs.ComposedTypeRef) TypeArgument(org.eclipse.n4js.ts.typeRefs.TypeArgument) RuleEnvironment(org.eclipse.xsemantics.runtime.RuleEnvironment)

Example 27 with RuleEnvironment

use of org.eclipse.xsemantics.runtime.RuleEnvironment in project n4js by eclipse.

the class Reducer method reduceStructuralTypeRef.

private boolean reduceStructuralTypeRef(TypeRef left, TypeRef right, Variance variance) {
    if (variance == CONTRA) {
        return reduceStructuralTypeRef(right, left, CO);
    }
    // now, variance is either CO or INV
    final StructuralTypingComputer stc = tsh.getStructuralTypingComputer();
    final RuleEnvironment G2 = RuleEnvironmentExtensions.wrap(G);
    final StructTypingInfo infoFaked = new // <- G2 will be changed!
    StructTypingInfo(// <- G2 will be changed!
    G2, // <- G2 will be changed!
    left, // <- G2 will be changed!
    right, left.getTypingStrategy(), right.getTypingStrategy());
    boolean wasAdded = false;
    final StructuralTypesHelper structTypesHelper = tsh.getStructuralTypesHelper();
    final StructuralMembersTripleIterator iter = structTypesHelper.getMembersTripleIterator(G2, left, right, false);
    while (iter.hasNext()) {
        final StructuralMembersTriple next = iter.next();
        final TMember l = next.getLeft();
        final TMember r = next.getRight();
        if (l == null || r == null) {
            // commencing with type inference here produces better error messages.)
            continue;
        }
        final TypeConstraint constraint = stc.reduceMembers(left, l, r, variance, infoFaked);
        if (containsReopenedExistentialType(G2, constraint)) {
            // TODO reconsider handling of re-opened ExistentialTypeRefs in InferenceContext, IDE-1653
            continue;
        }
        wasAdded |= reduce(constraint);
    }
    return wasAdded;
}
Also used : StructuralTypesHelper(org.eclipse.n4js.utils.StructuralTypesHelper) StructuralMembersTriple(org.eclipse.n4js.utils.StructuralMembersTriple) StructuralTypingComputer(org.eclipse.n4js.typesystem.StructuralTypingComputer) RuleEnvironment(org.eclipse.xsemantics.runtime.RuleEnvironment) TMember(org.eclipse.n4js.ts.types.TMember) StructTypingInfo(org.eclipse.n4js.typesystem.StructuralTypingComputer.StructTypingInfo) StructuralMembersTripleIterator(org.eclipse.n4js.utils.StructuralMembersTripleIterator)

Example 28 with RuleEnvironment

use of org.eclipse.xsemantics.runtime.RuleEnvironment in project n4js by eclipse.

the class InternalTypeSystem method applyRuleTypeCallExpression.

protected Result<TypeRef> applyRuleTypeCallExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ParameterizedCallExpression expr) throws RuleFailedException {
    // output parameter
    TypeRef T = null;
    /* G |- expr.target : var TypeRef targetTypeRef */
    Expression _target = expr.getTarget();
    TypeRef targetTypeRef = null;
    Result<TypeRef> result = typeInternal(G, _trace_, _target);
    checkAssignableTo(result.getFirst(), TypeRef.class);
    targetTypeRef = (TypeRef) result.getFirst();
    if ((targetTypeRef instanceof FunctionTypeExprOrRef)) {
        final FunctionTypeExprOrRef F = ((FunctionTypeExprOrRef) targetTypeRef);
        final TFunction tFunction = F.getFunctionType();
        /* { val inferring = env(G, GUARD_TYPE_CALL_EXPRESSION -> expr, TypeRef) G |- inferring ~> T } or { val G2 = G.wrap; G2.add(GUARD_TYPE_CALL_EXPRESSION -> expr, F.returnTypeRef) if(expr.eContainer instanceof AwaitExpression && expr.eContainmentFeature === N4JSPackage.eINSTANCE.getAwaitExpression_Expression() && tFunction!==null && AnnotationDefinition.PROMISIFIABLE.hasAnnotation(tFunction)) { T = promisifyHelper.extractPromisifiedReturnType(expr); } else { T = F.returnTypeRef ?: G.anyTypeRef; } typeSystemHelper.addSubstitutions(G2, expr, targetTypeRef); G2 |- T ~> T T = versionResolver.resolveVersion(T, F); if (T instanceof BoundThisTypeRef && !(expr.receiver instanceof ThisLiteral || expr.receiver instanceof SuperLiteral)) { G2 |~ T /\ T } } */
        {
            RuleFailedException previousFailure = null;
            try {
                Pair<String, ParameterizedCallExpression> _mappedTo = Pair.<String, ParameterizedCallExpression>of(RuleEnvironmentExtensions.GUARD_TYPE_CALL_EXPRESSION, expr);
                final TypeRef inferring = this.<TypeRef>env(G, _mappedTo, TypeRef.class);
                /* G |- inferring ~> T */
                Result<TypeArgument> result_1 = substTypeVariablesInternal(G, _trace_, inferring);
                checkAssignableTo(result_1.getFirst(), TypeRef.class);
                T = (TypeRef) result_1.getFirst();
            } catch (Exception e) {
                previousFailure = extractRuleFailedException(e);
                final RuleEnvironment G2 = RuleEnvironmentExtensions.wrap(G);
                Pair<String, ParameterizedCallExpression> _mappedTo_1 = Pair.<String, ParameterizedCallExpression>of(RuleEnvironmentExtensions.GUARD_TYPE_CALL_EXPRESSION, expr);
                boolean _add = G2.add(_mappedTo_1, F.getReturnTypeRef());
                /* G2.add(GUARD_TYPE_CALL_EXPRESSION -> expr, F.returnTypeRef) */
                if (!_add) {
                    sneakyThrowRuleFailedException("G2.add(GUARD_TYPE_CALL_EXPRESSION -> expr, F.returnTypeRef)");
                }
                if (((((expr.eContainer() instanceof AwaitExpression) && (expr.eContainmentFeature() == N4JSPackage.eINSTANCE.getAwaitExpression_Expression())) && (tFunction != null)) && AnnotationDefinition.PROMISIFIABLE.hasAnnotation(tFunction))) {
                    T = this.promisifyHelper.extractPromisifiedReturnType(expr);
                } else {
                    TypeRef _elvis = null;
                    TypeRef _returnTypeRef = F.getReturnTypeRef();
                    if (_returnTypeRef != null) {
                        _elvis = _returnTypeRef;
                    } else {
                        ParameterizedTypeRef _anyTypeRef = RuleEnvironmentExtensions.anyTypeRef(G);
                        _elvis = _anyTypeRef;
                    }
                    T = _elvis;
                }
                this.typeSystemHelper.addSubstitutions(G2, expr, targetTypeRef);
                /* G2 |- T ~> T */
                Result<TypeArgument> result_2 = substTypeVariablesInternal(G2, _trace_, T);
                checkAssignableTo(result_2.getFirst(), TypeRef.class);
                T = (TypeRef) result_2.getFirst();
                T = this.versionResolver.<TypeRef, FunctionTypeExprOrRef>resolveVersion(T, F);
                if (((T instanceof BoundThisTypeRef) && (!((expr.getReceiver() instanceof ThisLiteral) || (expr.getReceiver() instanceof SuperLiteral))))) {
                    /* G2 |~ T /\ T */
                    Result<TypeRef> result_3 = upperBoundInternal(G2, _trace_, T);
                    checkAssignableTo(result_3.getFirst(), TypeRef.class);
                    T = (TypeRef) result_3.getFirst();
                }
            }
        }
    } else {
        Type _declaredType = null;
        if (targetTypeRef != null) {
            _declaredType = targetTypeRef.getDeclaredType();
        }
        TObjectPrototype _functionType = RuleEnvironmentExtensions.functionType(G);
        boolean _tripleEquals = (_declaredType == _functionType);
        if (_tripleEquals) {
            T = RuleEnvironmentExtensions.anyTypeRef(G);
        } else {
            boolean _isDynamic = targetTypeRef.isDynamic();
            if (_isDynamic) {
                T = RuleEnvironmentExtensions.anyTypeRefDynamic(G);
            } else {
                T = TypeRefsFactory.eINSTANCE.createUnknownTypeRef();
            }
        }
    }
    return new Result<TypeRef>(T);
}
Also used : ThisLiteral(org.eclipse.n4js.n4JS.ThisLiteral) TObjectPrototype(org.eclipse.n4js.ts.types.TObjectPrototype) 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) ParameterizedCallExpression(org.eclipse.n4js.n4JS.ParameterizedCallExpression) TypeArgument(org.eclipse.n4js.ts.typeRefs.TypeArgument) SuperLiteral(org.eclipse.n4js.n4JS.SuperLiteral) TaggedTemplateString(org.eclipse.n4js.n4JS.TaggedTemplateString) RuleFailedException(org.eclipse.xsemantics.runtime.RuleFailedException) RuleFailedException(org.eclipse.xsemantics.runtime.RuleFailedException) Result(org.eclipse.xsemantics.runtime.Result) StructuralTypingResult(org.eclipse.n4js.typesystem.StructuralTypingResult) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) AwaitExpression(org.eclipse.n4js.n4JS.AwaitExpression) TFunction(org.eclipse.n4js.ts.types.TFunction) 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) 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) BoundThisTypeRef(org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef) FunctionTypeExprOrRef(org.eclipse.n4js.ts.typeRefs.FunctionTypeExprOrRef) RuleEnvironment(org.eclipse.xsemantics.runtime.RuleEnvironment) Pair(org.eclipse.xtext.xbase.lib.Pair) PropertyNameValuePair(org.eclipse.n4js.n4JS.PropertyNameValuePair)

Example 29 with RuleEnvironment

use of org.eclipse.xsemantics.runtime.RuleEnvironment in project n4js by eclipse.

the class InternalTypeSystem method applyRuleSubstTypeVariablesInParameterizedTypeRef.

protected Result<TypeArgument> applyRuleSubstTypeVariablesInParameterizedTypeRef(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ParameterizedTypeRef typeRef) throws RuleFailedException {
    // output parameter
    TypeRef result = null;
    result = typeRef;
    Type _declaredType = typeRef.getDeclaredType();
    if ((_declaredType instanceof TypeVariable)) {
        Type _declaredType_1 = typeRef.getDeclaredType();
        final TypeVariable typeVar = ((TypeVariable) _declaredType_1);
        /* { var temp = env(G, typeVar, TypeRef) if (typeRef instanceof ParameterizedTypeRefStructural) { if (temp instanceof ParameterizedTypeRef) { var ptrs = TypeUtils.copyToParameterizedTypeRefStructural(temp); ptrs.setTypingStrategy(typeRef.getTypingStrategy()); temp = ptrs; } } val tempDeclaredType = temp.declaredType if (typeVar !== tempDeclaredType && (TypeUtils.isOrContainsRefToTypeVar(temp) || (tempDeclaredType !== null && tempDeclaredType.generic)) && G.get(GUARD_SUBST_TYPE_VARS -> temp) === null) { val G2 = G.wrap; G2.add(GUARD_SUBST_TYPE_VARS -> temp, Boolean.TRUE) G2 |- temp ~> result result = TypeUtils.copy(result); } else { result = TypeUtils.copy(temp); } TypeUtils.copyTypeModifiers(result, typeRef) } or { val List<TypeRef> l_raw = env(G, typeVar, List) val l = newArrayList; for(var i=0;i<l_raw.size;i++) { val temp = l_raw.get(i); val tempDeclaredType = temp.declaredType; if(typeVar !== tempDeclaredType && (TypeUtils.isOrContainsRefToTypeVar(temp) || (tempDeclaredType !== null && tempDeclaredType.generic)) && G.get(GUARD_SUBST_TYPE_VARS -> temp) === null) { val G2 = G.wrap; G2.add(GUARD_SUBST_TYPE_VARS -> temp, Boolean.TRUE) G2 |- temp ~> var TypeRef tempResult tempResult = TypeUtils.copy(tempResult); l += tempResult; } else { l += TypeUtils.copy(temp); } } result = if(typeVar.declaredCovariant) { typeSystemHelper.createIntersectionType(G,l) } else if(typeVar.declaredContravariant) { typeSystemHelper.createUnionType(G,l) } else { G.addInconsistentSubstitutions(typeVar, l); TypeRefsFactory.eINSTANCE.createUnknownTypeRef }; TypeUtils.copyTypeModifiers(result, typeRef) } or { } */
        {
            RuleFailedException previousFailure = null;
            try {
                TypeRef temp = this.<TypeRef>env(G, typeVar, TypeRef.class);
                if ((typeRef instanceof ParameterizedTypeRefStructural)) {
                    if ((temp instanceof ParameterizedTypeRef)) {
                        ParameterizedTypeRefStructural ptrs = TypeUtils.copyToParameterizedTypeRefStructural(((ParameterizedTypeRef) temp));
                        ptrs.setTypingStrategy(((ParameterizedTypeRefStructural) typeRef).getTypingStrategy());
                        temp = ptrs;
                    }
                }
                final Type tempDeclaredType = temp.getDeclaredType();
                if ((((typeVar != tempDeclaredType) && (TypeUtils.isOrContainsRefToTypeVar(temp) || ((tempDeclaredType != null) && tempDeclaredType.isGeneric()))) && (G.get(Pair.<String, TypeRef>of(RuleEnvironmentExtensions.GUARD_SUBST_TYPE_VARS, temp)) == null))) {
                    final RuleEnvironment G2 = RuleEnvironmentExtensions.wrap(G);
                    Pair<String, TypeRef> _mappedTo = Pair.<String, TypeRef>of(RuleEnvironmentExtensions.GUARD_SUBST_TYPE_VARS, temp);
                    boolean _add = G2.add(_mappedTo, Boolean.TRUE);
                    /* G2.add(GUARD_SUBST_TYPE_VARS -> temp, Boolean.TRUE) */
                    if (!_add) {
                        sneakyThrowRuleFailedException("G2.add(GUARD_SUBST_TYPE_VARS -> temp, Boolean.TRUE)");
                    }
                    /* G2 |- temp ~> result */
                    Result<TypeArgument> result_1 = substTypeVariablesInternal(G2, _trace_, temp);
                    checkAssignableTo(result_1.getFirst(), TypeRef.class);
                    result = (TypeRef) result_1.getFirst();
                    result = TypeUtils.<TypeRef>copy(result);
                } else {
                    result = TypeUtils.<TypeRef>copy(temp);
                }
                TypeUtils.copyTypeModifiers(result, typeRef);
            } catch (Exception e) {
                previousFailure = extractRuleFailedException(e);
                /* { val List<TypeRef> l_raw = env(G, typeVar, List) val l = newArrayList; for(var i=0;i<l_raw.size;i++) { val temp = l_raw.get(i); val tempDeclaredType = temp.declaredType; if(typeVar !== tempDeclaredType && (TypeUtils.isOrContainsRefToTypeVar(temp) || (tempDeclaredType !== null && tempDeclaredType.generic)) && G.get(GUARD_SUBST_TYPE_VARS -> temp) === null) { val G2 = G.wrap; G2.add(GUARD_SUBST_TYPE_VARS -> temp, Boolean.TRUE) G2 |- temp ~> var TypeRef tempResult tempResult = TypeUtils.copy(tempResult); l += tempResult; } else { l += TypeUtils.copy(temp); } } result = if(typeVar.declaredCovariant) { typeSystemHelper.createIntersectionType(G,l) } else if(typeVar.declaredContravariant) { typeSystemHelper.createUnionType(G,l) } else { G.addInconsistentSubstitutions(typeVar, l); TypeRefsFactory.eINSTANCE.createUnknownTypeRef }; TypeUtils.copyTypeModifiers(result, typeRef) } or { } */
                {
                    try {
                        final List<TypeRef> l_raw = this.<List>env(G, typeVar, List.class);
                        final ArrayList<TypeRef> l = CollectionLiterals.<TypeRef>newArrayList();
                        for (int i = 0; (i < l_raw.size()); i++) {
                            final TypeRef temp_1 = l_raw.get(i);
                            final Type tempDeclaredType_1 = temp_1.getDeclaredType();
                            if ((((typeVar != tempDeclaredType_1) && (TypeUtils.isOrContainsRefToTypeVar(temp_1) || ((tempDeclaredType_1 != null) && tempDeclaredType_1.isGeneric()))) && (G.get(Pair.<String, TypeRef>of(RuleEnvironmentExtensions.GUARD_SUBST_TYPE_VARS, temp_1)) == null))) {
                                final RuleEnvironment G2_1 = RuleEnvironmentExtensions.wrap(G);
                                Pair<String, TypeRef> _mappedTo_1 = Pair.<String, TypeRef>of(RuleEnvironmentExtensions.GUARD_SUBST_TYPE_VARS, temp_1);
                                boolean _add_1 = G2_1.add(_mappedTo_1, Boolean.TRUE);
                                /* G2.add(GUARD_SUBST_TYPE_VARS -> temp, Boolean.TRUE) */
                                if (!_add_1) {
                                    sneakyThrowRuleFailedException("G2.add(GUARD_SUBST_TYPE_VARS -> temp, Boolean.TRUE)");
                                }
                                /* G2 |- temp ~> var TypeRef tempResult */
                                TypeRef tempResult = null;
                                Result<TypeArgument> result_2 = substTypeVariablesInternal(G2_1, _trace_, temp_1);
                                checkAssignableTo(result_2.getFirst(), TypeRef.class);
                                tempResult = (TypeRef) result_2.getFirst();
                                tempResult = TypeUtils.<TypeRef>copy(tempResult);
                                /* l += tempResult */
                                if (!l.add(tempResult)) {
                                    sneakyThrowRuleFailedException("l += tempResult");
                                }
                            } else {
                                TypeRef _copy = TypeUtils.<TypeRef>copy(temp_1);
                                /* l += TypeUtils.copy(temp) */
                                if (!l.add(_copy)) {
                                    sneakyThrowRuleFailedException("l += TypeUtils.copy(temp)");
                                }
                            }
                        }
                        TypeRef _xifexpression = null;
                        boolean _isDeclaredCovariant = typeVar.isDeclaredCovariant();
                        if (_isDeclaredCovariant) {
                            _xifexpression = this.typeSystemHelper.createIntersectionType(G, ((TypeRef[]) Conversions.unwrapArray(l, TypeRef.class)));
                        } else {
                            TypeRef _xifexpression_1 = null;
                            boolean _isDeclaredContravariant = typeVar.isDeclaredContravariant();
                            if (_isDeclaredContravariant) {
                                _xifexpression_1 = this.typeSystemHelper.createUnionType(G, ((TypeRef[]) Conversions.unwrapArray(l, TypeRef.class)));
                            } else {
                                UnknownTypeRef _xblockexpression = null;
                                {
                                    RuleEnvironmentExtensions.addInconsistentSubstitutions(G, typeVar, l);
                                    _xblockexpression = (TypeRefsFactory.eINSTANCE.createUnknownTypeRef());
                                }
                                _xifexpression_1 = _xblockexpression;
                            }
                            _xifexpression = _xifexpression_1;
                        }
                        result = _xifexpression;
                        TypeUtils.copyTypeModifiers(result, typeRef);
                    } catch (Exception e_1) {
                        previousFailure = extractRuleFailedException(e_1);
                    }
                }
            }
        }
    }
    boolean _and = false;
    Type _declaredType_2 = null;
    if (typeRef != null) {
        _declaredType_2 = typeRef.getDeclaredType();
    }
    boolean _tripleNotEquals = (_declaredType_2 != null);
    if (!_tripleNotEquals) {
        _and = false;
    } else {
        boolean _isGeneric = typeRef.getDeclaredType().isGeneric();
        _and = _isGeneric;
    }
    if (_and) {
        final int len = typeRef.getTypeArgs().size();
        boolean haveSubstitution = false;
        final TypeArgument[] argsChanged = new TypeArgument[len];
        for (int i = 0; (i < len); i++) {
            final TypeArgument arg = typeRef.getTypeArgs().get(i);
            /* G |- arg ~> var TypeArgument argSubst */
            TypeArgument argSubst = null;
            Result<TypeArgument> result_2 = substTypeVariablesInternal(G, _trace_, arg);
            checkAssignableTo(result_2.getFirst(), TypeArgument.class);
            argSubst = (TypeArgument) result_2.getFirst();
            if ((argSubst != arg)) {
                argsChanged[i] = argSubst;
                haveSubstitution = true;
            }
        }
        if (haveSubstitution) {
            if ((result == typeRef)) {
                result = TypeUtils.<ParameterizedTypeRef>copy(typeRef);
            }
            for (int i = 0; (i < len); i++) {
                final TypeArgument argCh = argsChanged[i];
                if ((argCh != null)) {
                    result.getTypeArgs().set(i, argCh);
                }
            }
        }
    }
    if ((result instanceof StructuralTypeRef)) {
        result = this.typeSystemHelper.substTypeVariablesInStructuralMembers(G, ((StructuralTypeRef) result));
    }
    return new Result<TypeArgument>(result);
}
Also used : ParameterizedTypeRefStructural(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRefStructural) 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) ArrayList(java.util.ArrayList) TypeArgument(org.eclipse.n4js.ts.typeRefs.TypeArgument) TaggedTemplateString(org.eclipse.n4js.n4JS.TaggedTemplateString) RuleFailedException(org.eclipse.xsemantics.runtime.RuleFailedException) RuleFailedException(org.eclipse.xsemantics.runtime.RuleFailedException) Result(org.eclipse.xsemantics.runtime.Result) StructuralTypingResult(org.eclipse.n4js.typesystem.StructuralTypingResult) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) 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) UnknownTypeRef(org.eclipse.n4js.ts.typeRefs.UnknownTypeRef) StructuralTypeRef(org.eclipse.n4js.ts.typeRefs.StructuralTypeRef) TypeVariable(org.eclipse.n4js.ts.types.TypeVariable) RuleEnvironment(org.eclipse.xsemantics.runtime.RuleEnvironment) ArrayList(java.util.ArrayList) List(java.util.List) EList(org.eclipse.emf.common.util.EList) Pair(org.eclipse.xtext.xbase.lib.Pair) PropertyNameValuePair(org.eclipse.n4js.n4JS.PropertyNameValuePair)

Example 30 with RuleEnvironment

use of org.eclipse.xsemantics.runtime.RuleEnvironment in project n4js by eclipse.

the class InternalTypeSystem method applyRuleTypePropertyAccessExpression.

protected Result<TypeRef> applyRuleTypePropertyAccessExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ParameterizedPropertyAccessExpression expr) throws RuleFailedException {
    // output parameter
    TypeRef T = null;
    /* { T = env(G, GUARD_TYPE_PROPERTY_ACCESS_EXPRESSION -> expr, TypeRef) } or { val G2 = G.wrap G2.add(GUARD_TYPE_PROPERTY_ACCESS_EXPRESSION -> expr, G2.anyTypeRef) G2 |- expr.target : var TypeRef receiverTypeRef typeSystemHelper.addSubstitutions(G2,receiverTypeRef) G2.addThisType(receiverTypeRef) if (! (receiverTypeRef instanceof UnknownTypeRef) && (expr.target instanceof SuperLiteral || expr.target instanceof ThisLiteral) ) { var containingClass = EcoreUtil2.getContainerOfType(expr,N4ClassDeclaration)?.definedType; if (containingClass instanceof TClass) { if (containingClass.isStaticPolyfill) { containingClass = containingClass.superClassRef?.declaredType } if (containingClass instanceof TClass) { if (containingClass?.superClassRef!==null) { typeSystemHelper.addSubstitutions(G2, containingClass.superClassRef) } } } } val prop = expr.property; var TypeRef propTypeRef; if(prop instanceof TMethod && (prop as TMethod).isConstructor) { val TypeArgument ctorTypeArg = switch(receiverTypeRef) { TypeTypeRef: G.functionTypeRef ParameterizedTypeRef, BoundThisTypeRef: { val declType = if(receiverTypeRef instanceof BoundThisTypeRef) { receiverTypeRef.actualThisTypeRef?.declaredType } else { receiverTypeRef.declaredType }; val finalCtorSig = if(declType instanceof TClassifier) N4JSLanguageUtils.hasCovariantConstructor(declType); if(finalCtorSig) { declType.ref } else if(declType!==null) { TypeUtils.createWildcardExtends(declType.ref) } else { null } } }; propTypeRef = if(ctorTypeArg!==null) { TypeUtils.createTypeTypeRef(ctorTypeArg, true) } else { TypeRefsFactory.eINSTANCE.createUnknownTypeRef }; } else if(receiverTypeRef.dynamic && prop!==null && prop.eIsProxy) { propTypeRef = G.anyTypeRefDynamic; } else { G2.wrap |- prop : propTypeRef if(expr.parameterized) { typeSystemHelper.addSubstitutions(G2,expr); } } G2 |- propTypeRef ~> T T = versionResolver.resolveVersion(T, receiverTypeRef); if (expr.target instanceof SuperLiteral && T instanceof FunctionTypeExprOrRef ) { val F = T as FunctionTypeExprOrRef; if ((T as FunctionTypeExprOrRef).returnTypeRef instanceof BoundThisTypeRef) { var TypeRef rawT; G |~ expr ~> rawT; val thisTypeRef = TypeUtils.enforceNominalTyping(rawT); if (T instanceof FunctionTypeExpression && T.eContainer===null) { val fte = T as FunctionTypeExpression fte.returnTypeRef = TypeUtils.copyIfContained(thisTypeRef); } else { T = TypeUtils.createFunctionTypeExpression(null, F.typeVars, F.fpars, thisTypeRef); } } } } */
    {
        RuleFailedException previousFailure = null;
        try {
            Pair<String, ParameterizedPropertyAccessExpression> _mappedTo = Pair.<String, ParameterizedPropertyAccessExpression>of(RuleEnvironmentExtensions.GUARD_TYPE_PROPERTY_ACCESS_EXPRESSION, expr);
            T = this.<TypeRef>env(G, _mappedTo, TypeRef.class);
        } catch (Exception e) {
            previousFailure = extractRuleFailedException(e);
            final RuleEnvironment G2 = RuleEnvironmentExtensions.wrap(G);
            Pair<String, ParameterizedPropertyAccessExpression> _mappedTo_1 = Pair.<String, ParameterizedPropertyAccessExpression>of(RuleEnvironmentExtensions.GUARD_TYPE_PROPERTY_ACCESS_EXPRESSION, expr);
            boolean _add = G2.add(_mappedTo_1, RuleEnvironmentExtensions.anyTypeRef(G2));
            /* G2.add(GUARD_TYPE_PROPERTY_ACCESS_EXPRESSION -> expr, G2.anyTypeRef) */
            if (!_add) {
                sneakyThrowRuleFailedException("G2.add(GUARD_TYPE_PROPERTY_ACCESS_EXPRESSION -> expr, G2.anyTypeRef)");
            }
            /* G2 |- expr.target : var TypeRef receiverTypeRef */
            Expression _target = expr.getTarget();
            TypeRef receiverTypeRef = null;
            Result<TypeRef> result = typeInternal(G2, _trace_, _target);
            checkAssignableTo(result.getFirst(), TypeRef.class);
            receiverTypeRef = (TypeRef) result.getFirst();
            this.typeSystemHelper.addSubstitutions(G2, receiverTypeRef);
            RuleEnvironmentExtensions.addThisType(G2, receiverTypeRef);
            if (((!(receiverTypeRef instanceof UnknownTypeRef)) && ((expr.getTarget() instanceof SuperLiteral) || (expr.getTarget() instanceof ThisLiteral)))) {
                N4ClassDeclaration _containerOfType = EcoreUtil2.<N4ClassDeclaration>getContainerOfType(expr, N4ClassDeclaration.class);
                Type _definedType = null;
                if (_containerOfType != null) {
                    _definedType = _containerOfType.getDefinedType();
                }
                Type containingClass = _definedType;
                if ((containingClass instanceof TClass)) {
                    boolean _isStaticPolyfill = ((TClass) containingClass).isStaticPolyfill();
                    if (_isStaticPolyfill) {
                        ParameterizedTypeRef _superClassRef = ((TClass) containingClass).getSuperClassRef();
                        Type _declaredType = null;
                        if (_superClassRef != null) {
                            _declaredType = _superClassRef.getDeclaredType();
                        }
                        containingClass = _declaredType;
                    }
                    if ((containingClass instanceof TClass)) {
                        ParameterizedTypeRef _superClassRef_1 = null;
                        if (((TClass) containingClass) != null) {
                            _superClassRef_1 = ((TClass) containingClass).getSuperClassRef();
                        }
                        boolean _tripleNotEquals = (_superClassRef_1 != null);
                        if (_tripleNotEquals) {
                            this.typeSystemHelper.addSubstitutions(G2, ((TClass) containingClass).getSuperClassRef());
                        }
                    }
                }
            }
            final IdentifiableElement prop = expr.getProperty();
            TypeRef propTypeRef = null;
            if (((prop instanceof TMethod) && ((TMethod) prop).isConstructor())) {
                TypeArgument _switchResult = null;
                boolean _matched = false;
                if (receiverTypeRef instanceof TypeTypeRef) {
                    _matched = true;
                    _switchResult = RuleEnvironmentExtensions.functionTypeRef(G);
                }
                if (!_matched) {
                    if (receiverTypeRef instanceof ParameterizedTypeRef) {
                        _matched = true;
                    }
                    if (!_matched) {
                        if (receiverTypeRef instanceof BoundThisTypeRef) {
                            _matched = true;
                        }
                    }
                    if (_matched) {
                        TypeArgument _xblockexpression = null;
                        {
                            Type _xifexpression = null;
                            if ((receiverTypeRef instanceof BoundThisTypeRef)) {
                                ParameterizedTypeRef _actualThisTypeRef = ((BoundThisTypeRef) receiverTypeRef).getActualThisTypeRef();
                                Type _declaredType_1 = null;
                                if (_actualThisTypeRef != null) {
                                    _declaredType_1 = _actualThisTypeRef.getDeclaredType();
                                }
                                _xifexpression = _declaredType_1;
                            } else {
                                _xifexpression = ((BaseTypeRef) receiverTypeRef).getDeclaredType();
                            }
                            final Type declType = _xifexpression;
                            boolean _xifexpression_1 = false;
                            if ((declType instanceof TClassifier)) {
                                _xifexpression_1 = N4JSLanguageUtils.hasCovariantConstructor(((TClassifier) declType));
                            }
                            final boolean finalCtorSig = _xifexpression_1;
                            TypeArgument _xifexpression_2 = null;
                            if (finalCtorSig) {
                                _xifexpression_2 = TypeExtensions.ref(declType);
                            } else {
                                Wildcard _xifexpression_3 = null;
                                if ((declType != null)) {
                                    _xifexpression_3 = TypeUtils.createWildcardExtends(TypeExtensions.ref(declType));
                                } else {
                                    _xifexpression_3 = null;
                                }
                                _xifexpression_2 = _xifexpression_3;
                            }
                            _xblockexpression = (_xifexpression_2);
                        }
                        _switchResult = _xblockexpression;
                    }
                }
                final TypeArgument ctorTypeArg = _switchResult;
                TypeRef _xifexpression = null;
                if ((ctorTypeArg != null)) {
                    _xifexpression = TypeUtils.createTypeTypeRef(ctorTypeArg, true);
                } else {
                    _xifexpression = TypeRefsFactory.eINSTANCE.createUnknownTypeRef();
                }
                propTypeRef = _xifexpression;
            } else {
                if (((receiverTypeRef.isDynamic() && (prop != null)) && prop.eIsProxy())) {
                    propTypeRef = RuleEnvironmentExtensions.anyTypeRefDynamic(G);
                } else {
                    /* G2.wrap |- prop : propTypeRef */
                    RuleEnvironment _wrap = RuleEnvironmentExtensions.wrap(G2);
                    Result<TypeRef> result_1 = typeInternal(_wrap, _trace_, prop);
                    checkAssignableTo(result_1.getFirst(), TypeRef.class);
                    propTypeRef = (TypeRef) result_1.getFirst();
                    boolean _isParameterized = expr.isParameterized();
                    if (_isParameterized) {
                        this.typeSystemHelper.addSubstitutions(G2, expr);
                    }
                }
            }
            /* G2 |- propTypeRef ~> T */
            Result<TypeArgument> result_2 = substTypeVariablesInternal(G2, _trace_, propTypeRef);
            checkAssignableTo(result_2.getFirst(), TypeRef.class);
            T = (TypeRef) result_2.getFirst();
            T = this.versionResolver.<TypeRef, TypeRef>resolveVersion(T, receiverTypeRef);
            if (((expr.getTarget() instanceof SuperLiteral) && (T instanceof FunctionTypeExprOrRef))) {
                final FunctionTypeExprOrRef F = ((FunctionTypeExprOrRef) T);
                TypeRef _returnTypeRef = ((FunctionTypeExprOrRef) T).getReturnTypeRef();
                if ((_returnTypeRef instanceof BoundThisTypeRef)) {
                    TypeRef rawT = null;
                    /* G |~ expr ~> rawT */
                    Result<TypeRef> result_3 = thisTypeRefInternal(G, _trace_, expr);
                    checkAssignableTo(result_3.getFirst(), TypeRef.class);
                    rawT = (TypeRef) result_3.getFirst();
                    final TypeRef thisTypeRef = TypeUtils.enforceNominalTyping(rawT);
                    if (((T instanceof FunctionTypeExpression) && (T.eContainer() == null))) {
                        final FunctionTypeExpression fte = ((FunctionTypeExpression) T);
                        fte.setReturnTypeRef(TypeUtils.<TypeRef>copyIfContained(thisTypeRef));
                    } else {
                        T = TypeUtils.createFunctionTypeExpression(null, F.getTypeVars(), F.getFpars(), thisTypeRef);
                    }
                }
            }
        }
    }
    return new Result<TypeRef>(T);
}
Also used : ParameterizedPropertyAccessExpression(org.eclipse.n4js.n4JS.ParameterizedPropertyAccessExpression) TClassifier(org.eclipse.n4js.ts.types.TClassifier) 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) SuperLiteral(org.eclipse.n4js.n4JS.SuperLiteral) TaggedTemplateString(org.eclipse.n4js.n4JS.TaggedTemplateString) RuleFailedException(org.eclipse.xsemantics.runtime.RuleFailedException) N4ClassDeclaration(org.eclipse.n4js.n4JS.N4ClassDeclaration) Result(org.eclipse.xsemantics.runtime.Result) StructuralTypingResult(org.eclipse.n4js.typesystem.StructuralTypingResult) UnknownTypeRef(org.eclipse.n4js.ts.typeRefs.UnknownTypeRef) Wildcard(org.eclipse.n4js.ts.typeRefs.Wildcard) TypeTypeRef(org.eclipse.n4js.ts.typeRefs.TypeTypeRef) RuleEnvironment(org.eclipse.xsemantics.runtime.RuleEnvironment) Pair(org.eclipse.xtext.xbase.lib.Pair) PropertyNameValuePair(org.eclipse.n4js.n4JS.PropertyNameValuePair) ThisLiteral(org.eclipse.n4js.n4JS.ThisLiteral) TMethod(org.eclipse.n4js.ts.types.TMethod) FunctionTypeExpression(org.eclipse.n4js.ts.typeRefs.FunctionTypeExpression) IdentifiableElement(org.eclipse.n4js.ts.types.IdentifiableElement) TypeArgument(org.eclipse.n4js.ts.typeRefs.TypeArgument) RuleFailedException(org.eclipse.xsemantics.runtime.RuleFailedException) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) 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) 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) BaseTypeRef(org.eclipse.n4js.ts.typeRefs.BaseTypeRef) StaticBaseTypeRef(org.eclipse.n4js.ts.typeRefs.StaticBaseTypeRef) BoundThisTypeRef(org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef) FunctionTypeExprOrRef(org.eclipse.n4js.ts.typeRefs.FunctionTypeExprOrRef) TClass(org.eclipse.n4js.ts.types.TClass)

Aggregations

RuleEnvironment (org.eclipse.xsemantics.runtime.RuleEnvironment)31 TypeRef (org.eclipse.n4js.ts.typeRefs.TypeRef)22 ParameterizedTypeRef (org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef)14 ComposedTypeRef (org.eclipse.n4js.ts.typeRefs.ComposedTypeRef)12 TypeArgument (org.eclipse.n4js.ts.typeRefs.TypeArgument)12 TypeTypeRef (org.eclipse.n4js.ts.typeRefs.TypeTypeRef)12 UnknownTypeRef (org.eclipse.n4js.ts.typeRefs.UnknownTypeRef)12 ExistentialTypeRef (org.eclipse.n4js.ts.typeRefs.ExistentialTypeRef)11 EObject (org.eclipse.emf.ecore.EObject)10 ThisTypeRef (org.eclipse.n4js.ts.typeRefs.ThisTypeRef)10 Result (org.eclipse.xsemantics.runtime.Result)10 BaseTypeRef (org.eclipse.n4js.ts.typeRefs.BaseTypeRef)9 BoundThisTypeRef (org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef)9 FunctionTypeRef (org.eclipse.n4js.ts.typeRefs.FunctionTypeRef)9 StaticBaseTypeRef (org.eclipse.n4js.ts.typeRefs.StaticBaseTypeRef)9 StructuralTypeRef (org.eclipse.n4js.ts.typeRefs.StructuralTypeRef)9 ContainerType (org.eclipse.n4js.ts.types.ContainerType)9 Type (org.eclipse.n4js.ts.types.Type)9 StructuralTypingResult (org.eclipse.n4js.typesystem.StructuralTypingResult)9 PrimitiveType (org.eclipse.n4js.ts.types.PrimitiveType)8