Search in sources :

Example 1 with UnboundTypeReference

use of org.eclipse.xtext.xbase.typesystem.references.UnboundTypeReference in project xtext-xtend by eclipse.

the class DeferredTypeParameterHintCollectorTest method hasHintsFor.

public List<LightweightBoundTypeArgument> hasHintsFor(final Map<JvmTypeParameter, LightweightMergedBoundTypeArgument> mapping, final String typeParamName) {
    final Set<JvmTypeParameter> allKeys = mapping.keySet();
    for (final JvmTypeParameter key : allKeys) {
        String _simpleName = key.getSimpleName();
        boolean _equals = Objects.equal(_simpleName, typeParamName);
        if (_equals) {
            LightweightTypeReference _typeReference = mapping.get(key).getTypeReference();
            final UnboundTypeReference unbound = ((UnboundTypeReference) _typeReference);
            final Consumer<LightweightBoundTypeArgument> _function = (LightweightBoundTypeArgument it) -> {
                Assert.assertEquals(BoundTypeArgumentSource.INFERRED_LATER, it.getSource());
            };
            unbound.getAllHints().forEach(_function);
            return unbound.getAllHints();
        }
    }
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("No mapping for ");
    _builder.append(typeParamName);
    _builder.append(" in ");
    final Function1<JvmTypeParameter, String> _function_1 = (JvmTypeParameter it) -> {
        return it.getSimpleName();
    };
    Iterable<String> _map = IterableExtensions.<JvmTypeParameter, String>map(mapping.keySet(), _function_1);
    _builder.append(_map);
    Assert.fail(_builder.toString());
    return null;
}
Also used : LightweightTypeReference(org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference) JvmTypeParameter(org.eclipse.xtext.common.types.JvmTypeParameter) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) UnboundTypeReference(org.eclipse.xtext.xbase.typesystem.references.UnboundTypeReference) LightweightBoundTypeArgument(org.eclipse.xtext.xbase.typesystem.references.LightweightBoundTypeArgument)

Example 2 with UnboundTypeReference

use of org.eclipse.xtext.xbase.typesystem.references.UnboundTypeReference in project xtext-xtend by eclipse.

the class DeferredTypeParameterHintCollectorTest method hasNoHintsFor.

public void hasNoHintsFor(final Map<JvmTypeParameter, LightweightMergedBoundTypeArgument> mapping, final String typeParamName) {
    final Set<JvmTypeParameter> allKeys = mapping.keySet();
    for (final JvmTypeParameter key : allKeys) {
        String _simpleName = key.getSimpleName();
        boolean _equals = Objects.equal(_simpleName, typeParamName);
        if (_equals) {
            LightweightTypeReference _typeReference = mapping.get(key).getTypeReference();
            final UnboundTypeReference unbound = ((UnboundTypeReference) _typeReference);
            boolean _isEmpty = unbound.getAllHints().isEmpty();
            boolean _not = (!_isEmpty);
            if (_not) {
                StringConcatenation _builder = new StringConcatenation();
                _builder.append("Unexpected mapping for ");
                _builder.append(typeParamName);
                _builder.append(" in ");
                final Function1<JvmTypeParameter, String> _function = (JvmTypeParameter it) -> {
                    return it.getSimpleName();
                };
                Iterable<String> _map = IterableExtensions.<JvmTypeParameter, String>map(mapping.keySet(), _function);
                _builder.append(_map);
                Assert.fail(_builder.toString());
            }
        }
    }
}
Also used : LightweightTypeReference(org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference) JvmTypeParameter(org.eclipse.xtext.common.types.JvmTypeParameter) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) UnboundTypeReference(org.eclipse.xtext.xbase.typesystem.references.UnboundTypeReference)

Aggregations

StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)2 JvmTypeParameter (org.eclipse.xtext.common.types.JvmTypeParameter)2 LightweightTypeReference (org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference)2 UnboundTypeReference (org.eclipse.xtext.xbase.typesystem.references.UnboundTypeReference)2 LightweightBoundTypeArgument (org.eclipse.xtext.xbase.typesystem.references.LightweightBoundTypeArgument)1