Search in sources :

Example 1 with MockTypeParameterSubstitutor

use of org.eclipse.xtend.core.tests.typesystem.MockTypeParameterSubstitutor in project xtext-xtend by eclipse.

the class DeferredTypeParameterHintCollectorTest method in.

public Map<JvmTypeParameter, LightweightMergedBoundTypeArgument> in(final String typeParameters, final String expectedType, final String actualType) {
    final JvmOperation operation = this.operation(typeParameters, expectedType, actualType);
    ITypeReferenceOwner _owner = this.getOwner();
    final DeferredTypeParameterHintCollector collector = new DeferredTypeParameterHintCollector(_owner);
    final DefaultReentrantTypeResolver resolver = this.resolverProvider.get();
    resolver.initializeFrom(EcoreUtil.getRootContainer(operation));
    ITypeReferenceOwner _owner_1 = this.getOwner();
    PublicResolvedTypes _publicResolvedTypes = new PublicResolvedTypes(resolver);
    final MockTypeParameterSubstitutor substitutor = new MockTypeParameterSubstitutor(_owner_1, _publicResolvedTypes);
    final LightweightTypeReference hasUnbounds = substitutor.substitute(this.toLightweightTypeReference(IterableExtensions.<JvmFormalParameter>head(operation.getParameters()).getParameterType()));
    final LightweightTypeReference isActual = this.toLightweightTypeReference(IterableExtensions.<JvmFormalParameter>last(operation.getParameters()).getParameterType());
    collector.processPairedReferences(hasUnbounds, isActual);
    return substitutor.getTypeParameterMapping();
}
Also used : JvmOperation(org.eclipse.xtext.common.types.JvmOperation) MockTypeParameterSubstitutor(org.eclipse.xtend.core.tests.typesystem.MockTypeParameterSubstitutor) LightweightTypeReference(org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference) JvmFormalParameter(org.eclipse.xtext.common.types.JvmFormalParameter) DeferredTypeParameterHintCollector(org.eclipse.xtext.xbase.typesystem.util.DeferredTypeParameterHintCollector) PublicResolvedTypes(org.eclipse.xtend.core.tests.typesystem.PublicResolvedTypes) ITypeReferenceOwner(org.eclipse.xtext.xbase.typesystem.references.ITypeReferenceOwner) DefaultReentrantTypeResolver(org.eclipse.xtext.xbase.typesystem.internal.DefaultReentrantTypeResolver)

Aggregations

MockTypeParameterSubstitutor (org.eclipse.xtend.core.tests.typesystem.MockTypeParameterSubstitutor)1 PublicResolvedTypes (org.eclipse.xtend.core.tests.typesystem.PublicResolvedTypes)1 JvmFormalParameter (org.eclipse.xtext.common.types.JvmFormalParameter)1 JvmOperation (org.eclipse.xtext.common.types.JvmOperation)1 DefaultReentrantTypeResolver (org.eclipse.xtext.xbase.typesystem.internal.DefaultReentrantTypeResolver)1 ITypeReferenceOwner (org.eclipse.xtext.xbase.typesystem.references.ITypeReferenceOwner)1 LightweightTypeReference (org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference)1 DeferredTypeParameterHintCollector (org.eclipse.xtext.xbase.typesystem.util.DeferredTypeParameterHintCollector)1