Java Code Examples for org.eclipse.xtext.xbase.typesystem.InferredTypeIndicator#resolveTo()

The following examples show how to use org.eclipse.xtext.xbase.typesystem.InferredTypeIndicator#resolveTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DispatchOperationBodyComputationState.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Override
/* @Nullable */
protected LightweightTypeReference getExpectedType() {
	LightweightTypeReference expectedType = super.getExpectedType();
	if (expectedType != null) {
		return expectedType;
	}
	if (dispatcher != null) {
		JvmOperation operation = (JvmOperation) getMember();
		if (!InferredTypeIndicator.isInferred(dispatcher.getReturnType())) {
			LightweightTypeReference result = getResolvedTypes().getActualType(dispatcher);
			if (result != null)
				InferredTypeIndicator.resolveTo(operation.getReturnType(), result.toJavaCompliantTypeReference());
			return result;
		}
	}
	return inheritedExpectedType;
}
 
Example 2
Source File: OperationBodyComputationState.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
/* @Nullable */
protected LightweightTypeReference getExpectedType() {
	JvmOperation operation = (JvmOperation) getMember();
	LightweightTypeReference expectedType = ((LogicalContainerAwareReentrantTypeResolver)getResolver()).getReturnTypeOfOverriddenOperation(operation, resolvedTypes, getFeatureScopeSession());
	if (expectedType != null) {
		InferredTypeIndicator.resolveTo(operation.getReturnType(), expectedType.toJavaCompliantTypeReference());
		return expectedType;
	}
	return getResolvedTypes().getExpectedTypeForAssociatedExpression(getMember(), getNonNullRootExpression());
}
 
Example 3
Source File: OperationBodyComputationState.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected ITypeComputationResult createNoTypeResult() {
	JvmOperation operation = (JvmOperation) getMember();
	LightweightTypeReference expectedType = ((LogicalContainerAwareReentrantTypeResolver)getResolver()).getReturnTypeOfOverriddenOperation(operation, resolvedTypes, getFeatureScopeSession());
	if (expectedType != null) {
		InferredTypeIndicator.resolveTo(operation.getReturnType(), expectedType.toJavaCompliantTypeReference());
	}
	return new NoTypeResult(getMember(), resolvedTypes.getReferenceOwner());
}
 
Example 4
Source File: XtendReentrantTypeResolver.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void resolveDispatchCaseTypes(JvmOperation dispatcher, List<JvmOperation> dispatchCases, LightweightTypeReference type,
		IFeatureScopeSession featureScopeSession) {
	if (InferredTypeIndicator.isInferred(dispatcher.getReturnType())) {
		InferredTypeIndicator.resolveTo(dispatcher.getReturnType(), toJavaCompliantTypeReference(type, featureScopeSession));
	}
	for (JvmOperation dispatchCase : dispatchCases) {
		if (InferredTypeIndicator.isInferred(dispatchCase.getReturnType())) {
			InferredTypeIndicator.resolveTo(dispatchCase.getReturnType(), toJavaCompliantTypeReference(type, featureScopeSession));
		}
	}
}