@Override public boolean isVoidTypeAllowed(XExpression expression) { TypeData typeData = getTypeData(expression, false); if (typeData != null) return typeData.getExpectation().isVoidTypeAllowed(); return true; }
protected LightweightTypeReference doGetExpectedType(XExpression expression, boolean returnType) { TypeData typeData = getTypeData(expression, returnType, !returnType); if (typeData != null) { return typeData.getExpectation().getExpectedType(); } return null; }
public boolean isVoidReturnTypeAllowed(XExpression expression) { TypeData typeData = getTypeData(expression, true); if (typeData != null && typeData.isReturnType()) return typeData.getExpectation().isVoidTypeAllowed(); return true; }
mergeData.references.add(reference); mergeData.mergedFlags = flags; mergeData.expectation = value.getExpectation(); mergeData.voidSeen = false; return; mergeData.expectation = value.getExpectation(); } else if (mergeData.expectation.getExpectedType() == null) { ITypeExpectation knownExpectation = value.getExpectation(); if (knownExpectation.getExpectedType() != null) { mergeData.expectation = knownExpectation;
private TypeData getSingleMergeResult(TypeData typeData, final XExpression expression, boolean returnType) { LightweightTypeReference upperBoundSubstitute = typeData.getActualType().getUpperBoundSubstitute(); if (upperBoundSubstitute != typeData.getActualType()) return new TypeData(expression, typeData.getExpectation(), upperBoundSubstitute, typeData.getConformanceFlags(), returnType); return typeData; }
protected TypeData prepareMerge(TypeData typeData, ITypeReferenceOwner owner) { LightweightTypeReference typeReference = typeData.getActualType(); if (typeData.isOwnedBy(owner) && !(typeReference instanceof UnboundTypeReference)) return typeData; if (typeReference instanceof UnboundTypeReference && super.isResolved(((UnboundTypeReference) typeReference).getHandle())) { typeReference = typeReference.getUpperBoundSubstitute(); } return new TypeData(typeData.getExpression(), typeData.getExpectation().copyInto(owner), typeReference.copyInto(owner), typeData.getConformanceFlags(), typeData.isReturnType()); }
protected int getConformanceFlags(TypeData typeData, boolean recompute) { int flags = typeData.getConformanceFlags(); if (recompute) { if ((flags & ConformanceFlags.SEALED) != 0) { ConformanceFlags.sanityCheck(flags); return flags; } flags &= ~(ConformanceFlags.INCOMPATIBLE | ConformanceFlags.SUCCESS); flags |= ConformanceFlags.UNCHECKED; } if ((flags & ConformanceFlags.UNCHECKED) != 0) { LightweightTypeReference actualType = typeData.getActualType(); ITypeExpectation expectation = typeData.getExpectation(); LightweightTypeReference expectedType = expectation.getExpectedType(); if (expectedType != null) { int conformanceResult = expectedType.getUpperBoundSubstitute().internalIsAssignableFrom( actualType, TypeConformanceComputationArgument.DEFAULT); flags |= conformanceResult | ConformanceFlags.CHECKED; flags &= ~ConformanceFlags.UNCHECKED; } else { flags &= ~ConformanceFlags.UNCHECKED; flags |= ConformanceFlags.CHECKED_SUCCESS; } } ConformanceFlags.sanityCheck(flags); typeData.setConformanceFlags(flags); return flags; }
protected void addTypeDiagnostic(XExpression expression, /* @Nullable */ TypeData typeData, IAcceptor<? super AbstractDiagnostic> acceptor) { if (typeData != null) { LightweightTypeReference actualType = typeData.getActualType(); ITypeExpectation expectation = typeData.getExpectation(); int knownFlags = typeData.getConformanceFlags(); if ((knownFlags & (ConformanceFlags.NO_IMPLICIT_RETURN | ConformanceFlags.PROPAGATED_TYPE)) == 0) {