org.eclipse.xtext.xbase.lib.Pair Java Examples

The following examples show how to use org.eclipse.xtext.xbase.lib.Pair. 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: AbstractCallHierarchyViewPart.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected TableViewer createLocationViewer(Composite parent) {
	TableViewer locationViewer = new TableViewer(parent);
	locationViewer.setContentProvider(new ArrayContentProvider());
	locationViewer.setLabelProvider(createLocationLabelProvider());

	TableLayout layout = new TableLayout();
	locationViewer.getTable().setLayout(layout);
	locationViewer.getTable().setHeaderVisible(true);

	Pair<String, ColumnLayoutData>[] locationColumnDescriptions = getLocationColumnDescriptions();
	IntStream.range(0, locationColumnDescriptions.length).forEach(index -> {
		layout.addColumnData(locationColumnDescriptions[index].getValue());
		createColumn(locationViewer.getTable(), locationColumnDescriptions[index], index);
	});

	return locationViewer;
}
 
Example #2
Source File: BoundTypeArgumentMergerTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testBug470766_01() {
  boolean _isJava12OrLater = AbstractXtendTestCase.isJava12OrLater();
  if (_isJava12OrLater) {
    Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("void", VarianceInfo.OUT);
    Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.INVARIANT);
    Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("Integer", VarianceInfo.OUT);
    Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.INVARIANT);
    Pair<String, VarianceInfo> _mappedTo_4 = Pair.<String, VarianceInfo>of("Long", VarianceInfo.OUT);
    Triple<String, VarianceInfo, VarianceInfo> _mappedTo_5 = this.operator_mappedTo(_mappedTo_4, VarianceInfo.INVARIANT);
    this.to(this.merge(_mappedTo_1, _mappedTo_3, _mappedTo_5), "Number & Comparable<?> & Constable & ConstantDesc", VarianceInfo.INVARIANT);
  } else {
    Pair<String, VarianceInfo> _mappedTo_6 = Pair.<String, VarianceInfo>of("void", VarianceInfo.OUT);
    Triple<String, VarianceInfo, VarianceInfo> _mappedTo_7 = this.operator_mappedTo(_mappedTo_6, VarianceInfo.INVARIANT);
    Pair<String, VarianceInfo> _mappedTo_8 = Pair.<String, VarianceInfo>of("Integer", VarianceInfo.OUT);
    Triple<String, VarianceInfo, VarianceInfo> _mappedTo_9 = this.operator_mappedTo(_mappedTo_8, VarianceInfo.INVARIANT);
    Pair<String, VarianceInfo> _mappedTo_10 = Pair.<String, VarianceInfo>of("Long", VarianceInfo.OUT);
    Triple<String, VarianceInfo, VarianceInfo> _mappedTo_11 = this.operator_mappedTo(_mappedTo_10, VarianceInfo.INVARIANT);
    this.to(this.merge(_mappedTo_7, _mappedTo_9, _mappedTo_11), "Number & Comparable<?>", VarianceInfo.INVARIANT);
  }
}
 
Example #3
Source File: CommandRebuildTest.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * The build triggered by the rebuild command must send 'publishDiagnostics' events even for those resources that do
 * not contain any issues, to ensure that any obsolete issues for those resources that might exist on client side
 * are removed. Normally such obsolete issues should not exist (not at start up time, because LSP clients do not
 * serialize issues; and not when rebuild is triggered manually, because an incremental build should have removed
 * those issues); however, in case of bugs in the incremental builder or other special circumstances this may
 * happen.
 */
@Test
public void testPublishDiagnosticsSentForModuleWithoutIssues() {
	testWorkspaceManager.createTestProjectOnDisk(Pair.of("Main", "let x: string = 42; x;"));
	startAndWaitForLspServer();

	assertIssues(Pair.of("Main", Lists.newArrayList(
			"(Error, [0:16 - 0:18], int is not a subtype of string.)")));

	// fix the error on disk, but don't let the LSP server know (to avoid incremental build)
	changeFileOnDiskWithoutNotification("Main", Pair.of("string", "number"));

	// send command under test
	ExecuteCommandParams params = new ExecuteCommandParams(N4JSCommandService.N4JS_REBUILD,
			Collections.emptyList());
	languageServer.executeCommand(params).join();

	// wait for previous command to finish
	joinServerRequests();

	assertNoIssues();
}
 
Example #4
Source File: LauncherTest.java    From lsp4j with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testRequest() throws Exception {
	CompletionParams p = new CompletionParams();
	p.setPosition(new Position(1,1));
	p.setTextDocument(new TextDocumentIdentifier("test/foo.txt"));
	
	CompletionList result = new CompletionList();
	result.setIsIncomplete(true);
	result.setItems(new ArrayList<>());
	
	CompletionItem item = new CompletionItem();
	item.setDetail("test");
	item.setDocumentation("doc");
	item.setFilterText("filter");
	item.setInsertText("insert");
	item.setKind(CompletionItemKind.Field);
	result.getItems().add(item);
	
	server.expectedRequests.put("textDocument/completion", new Pair<>(p, result));
	CompletableFuture<Either<List<CompletionItem>, CompletionList>> future = clientLauncher.getRemoteProxy().getTextDocumentService().completion(p);
	Assert.assertEquals(Either.forRight(result).toString(), future.get(TIMEOUT, TimeUnit.MILLISECONDS).toString());
	client.joinOnEmpty();
}
 
Example #5
Source File: ActiveAnnotationContextProvider.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
protected void registerMacroAnnotations(final XtendAnnotationTarget candidate, final IAcceptor<Pair<JvmAnnotationType, XAnnotation>> acceptor) {
  final Function1<XAnnotation, Boolean> _function = (XAnnotation it) -> {
    return Boolean.valueOf(this._xAnnotationExtensions.isProcessed(it));
  };
  Iterable<XAnnotation> _filter = IterableExtensions.<XAnnotation>filter(candidate.getAnnotations(), _function);
  for (final XAnnotation annotation : _filter) {
    {
      final JvmAnnotationType activeAnnotationDeclaration = this._xAnnotationExtensions.tryFindAnnotationType(annotation);
      if ((activeAnnotationDeclaration != null)) {
        boolean _isValid = this.isValid(annotation, activeAnnotationDeclaration);
        if (_isValid) {
          Pair<JvmAnnotationType, XAnnotation> _mappedTo = Pair.<JvmAnnotationType, XAnnotation>of(activeAnnotationDeclaration, annotation);
          acceptor.accept(_mappedTo);
        }
      }
    }
  }
}
 
Example #6
Source File: ApiImplMapping.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * In {@link #hasErrors() case of error}, returns human-readable error messages. Otherwise, an empty list will be
 * returned.
 */
public List<String> getErrorMessages() {
	final List<String> msgs = new ArrayList<>();
	for (IN4JSProject p : projectsWithUndefImplIds) {
		msgs.add("project '" + p.getProjectName() + "' does not define an ImplementationId in its manifest");
	}
	for (Map.Entry<Pair<N4JSProjectName, N4JSProjectName>, Set<IN4JSProject>> currConflict : conflicts.entrySet()) {
		final N4JSProjectName apiId = currConflict.getKey().getKey();
		final N4JSProjectName implId = currConflict.getKey().getValue();
		final Set<IN4JSProject> culprits = currConflict.getValue();
		final String culpritsStr = " - "
				+ culprits.stream().map(c -> c.getProjectName().getRawName()).collect(Collectors.joining("\n - "));
		msgs.add("several projects define an implementation for API project '" + apiId
				+ "' with implementation ID '" + implId + "':\n" + culpritsStr);
	}
	return msgs;
}
 
Example #7
Source File: MrsGrantsSecretCompartmentsProject.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private Pair<String, Image> image(final String id) {
  PluginImageHelper _pluginImageHelper = new PluginImageHelper();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("platform:/plugin/");
  _builder.append(FowlerdslActivator.PLUGIN_ID);
  _builder.append("/");
  _builder.append(id);
  Image _image = _pluginImageHelper.getImage(_builder.toString());
  return Pair.<String, Image>of(id, _image);
}
 
Example #8
Source File: MapExtensionsTest.java    From xtext-lib with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void operator_remove_MapPair_0() {
	String v = UUID.randomUUID().toString();
	boolean o;
	
	o = operator_remove(this.map, new Pair<String, String>("k3", v));
	assertFalse(o);
	assertEquals(2, this.map.size());
	assertEquals(this.value1, this.map.get("k1"));
	assertEquals(this.value2, this.map.get("k2"));
}
 
Example #9
Source File: BoundTypeArgumentMergerTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testArgumentTypeUsedTwice_09_c() {
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.IN);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.IN);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("String", VarianceInfo.IN);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.INVARIANT);
  this.to(this.merge(_mappedTo_1, _mappedTo_3), "String", VarianceInfo.INVARIANT);
}
 
Example #10
Source File: ActualTypeArgumentCollectorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testUnambiguousMapping_05() {
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _mappedBy = this.mappedBy("T, T2", "T", "CharSequence", "T2", "CharSequence");
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("CharSequence", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.OUT);
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _assertMapping = this.assertMapping(_mappedBy, "T", _mappedTo_1);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("CharSequence", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.OUT);
  this.assertMapping(_assertMapping, "T2", _mappedTo_3);
}
 
Example #11
Source File: IdeContentProposalAcceptor.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void accept(ContentAssistEntry entry, int priority) {
	if (entry != null) {
		if (entry.getProposal() == null)
			throw new IllegalArgumentException("Proposal must not be null.");
		entries.add(Pair.of(priority, entry));
	}
}
 
Example #12
Source File: BoundTypeArgumentMergerTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testArgumentTypeUsedTwice_07_g() {
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.IN);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.INVARIANT);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.IN);
  this.to(this.merge(_mappedTo_1, _mappedTo_3), "String", null);
}
 
Example #13
Source File: XtendGenerator.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String reassignThisType(final ITreeAppendable b, final JvmDeclaredType declaredType) {
  String _xblockexpression = null;
  {
    boolean _hasObject = b.hasObject("this");
    if (_hasObject) {
      final Object element = b.getObject("this");
      if ((element instanceof JvmDeclaredType)) {
        boolean _isLocal = ((JvmDeclaredType)element).isLocal();
        if (_isLocal) {
          Pair<String, JvmDeclaredType> _mappedTo = Pair.<String, JvmDeclaredType>of("this", ((JvmDeclaredType)element));
          boolean _hasName = b.hasName(_mappedTo);
          if (_hasName) {
            Pair<String, JvmDeclaredType> _mappedTo_1 = Pair.<String, JvmDeclaredType>of("this", ((JvmDeclaredType)element));
            b.declareVariable(element, b.getName(_mappedTo_1));
          } else {
            b.declareVariable(element, "");
          }
        } else {
          String _simpleName = ((JvmDeclaredType)element).getSimpleName();
          final String proposedName = (_simpleName + ".this");
          b.declareVariable(element, proposedName);
        }
      }
    }
    String _xifexpression = null;
    if ((declaredType != null)) {
      _xifexpression = b.declareVariable(declaredType, "this");
    }
    _xblockexpression = _xifexpression;
  }
  return _xblockexpression;
}
 
Example #14
Source File: ActualTypeArgumentCollectorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testLowerBound_02() {
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _mappedBy = this.mappedBy("T", "Iterable<? super T>", "Iterable<? super String>");
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.IN);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.IN);
  this.assertMapping(_mappedBy, "T", _mappedTo_1);
}
 
Example #15
Source File: ConstantExpressionsInterpreterTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void evaluatesTo(final Pair<String, String> typeAndExpression, final Procedure1<? super Object> assertions) {
  try {
    final String type = typeAndExpression.getKey();
    final String expression = typeAndExpression.getValue();
    String _elvis = null;
    if (type != null) {
      _elvis = type;
    } else {
      _elvis = "void";
    }
    String _plus = ("def " + _elvis);
    String _plus_1 = (_plus + " testFoo() { ");
    String _plus_2 = (_plus_1 + expression);
    String _plus_3 = (_plus_2 + " }");
    final XtendFunction function = this.function(_plus_3);
    XExpression _expression = function.getExpression();
    final XExpression expr = IterableExtensions.<XExpression>head(((XBlockExpression) _expression).getExpressions());
    JvmTypeReference _xifexpression = null;
    if ((type != null)) {
      _xifexpression = function.getReturnType();
    }
    final Object value = this.interpreter.evaluate(expr, _xifexpression);
    assertions.apply(value);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example #16
Source File: BoundTypeArgumentMergerTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testArgumentTypeUsedTwice_04_f() {
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.IN);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("String", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.OUT);
  this.to(this.merge(_mappedTo_1, _mappedTo_3), "String", null);
}
 
Example #17
Source File: CompilationTestHelper.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * same as {@link #resourceSet(Pair...)} but without actually loading the created resources.
 */
@SuppressWarnings("unchecked")
public ResourceSet unLoadedResourceSet(Pair<String,? extends CharSequence> ...resources ) throws IOException {
	XtextResourceSet result = resourceSetProvider.get();
	for (Pair<String, ? extends CharSequence> entry : resources) {
		URI uri = copyToWorkspace(getSourceFolderPath()+"/"+entry.getKey(), entry.getValue());
		Resource resource = result.createResource(uri);
		if (resource == null)
			throw new IllegalStateException("Couldn't create resource for URI "+uri+". Resource.Factory not registered?");
	}
	return result;
}
 
Example #18
Source File: BoundTypeArgumentMergerTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testArgumentTypeUsedTwice_06_g() {
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.INVARIANT);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.IN);
  this.to(this.merge(_mappedTo_1, _mappedTo_3), "String", null);
}
 
Example #19
Source File: ActualTypeArgumentCollectorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testUpperBound_09() {
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _mappedBy = this.mappedBy("T", "Iterable<? extends Iterable<T>>", "Iterable<? extends Iterable<CharSequence>>");
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("CharSequence", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.INVARIANT);
  this.assertMapping(_mappedBy, "T", _mappedTo_1);
}
 
Example #20
Source File: BoundTypeArgumentMergerTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testArgumentTypeUsedTwice_01_c() {
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.IN);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("String", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.INVARIANT);
  this.to(this.merge(_mappedTo_1, _mappedTo_3), "String", null);
}
 
Example #21
Source File: Xbase01_Literals.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public Map<String, String> myMethod() throws Throwable {
  Map<String, String> _xblockexpression = null;
  {
    /* null */
    /* "Hello World" */
    /* true */
    /* false */
    /* 42 */
    /* 0.42e2 */
    /* new BigInteger("beefbeefbeefbeefbeef", 16) */
    /* new BigDecimal("0.123456789123456789123456789123456789e4242") */
    /* String.class */
    String.class.getField("CASE_INSENSITIVE_ORDER");
    /* Map.Entry.class */
    /* CollectionLiterals.<Integer>newArrayList(Integer.valueOf(3), Integer.valueOf(5), Integer.valueOf(7)); */
    /* CollectionLiterals.<String>newHashSet("foo", "bar", "baz"); */
    Pair<Integer, String> _mappedTo = Pair.<Integer, String>of(Integer.valueOf(1), "one");
    Pair<Integer, String> _mappedTo_1 = Pair.<Integer, String>of(Integer.valueOf(2), "two");
    Pair<Integer, String> _mappedTo_2 = Pair.<Integer, String>of(Integer.valueOf(3), "three");
    /* CollectionLiterals.<Integer, String>newHashMap(_mappedTo, _mappedTo_1, _mappedTo_2); */
    String[] stringArray = { "a", "b", "c" };
    /* stringArray[1]; */
    List<String> listOfStrings = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("a", "b", "c"));
    /* listOfStrings; */
    Set<String> setOfStrings = Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet("a", "b", "c"));
    /* setOfStrings; */
    Pair<String, String> _mappedTo_3 = Pair.<String, String>of("a", "A");
    Pair<String, String> _mappedTo_4 = Pair.<String, String>of("b", "B");
    Pair<String, String> _mappedTo_5 = Pair.<String, String>of("c", "C");
    Map<String, String> immutableMap = Collections.<String, String>unmodifiableMap(CollectionLiterals.<String, String>newHashMap(_mappedTo_3, _mappedTo_4, _mappedTo_5));
    _xblockexpression = immutableMap;
  }
  return _xblockexpression;
}
 
Example #22
Source File: ActualTypeArgumentCollectorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testLowerBound_05() {
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _mappedBy = this.mappedBy("T, T2 extends T", "java.util.Map<? super T, T>", "java.util.Map<? extends String, Integer>");
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.IN);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.OUT);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("Integer", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.INVARIANT);
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _assertMapping = this.assertMapping(_mappedBy, "T", _mappedTo_1, _mappedTo_3);
  Pair<String, VarianceInfo> _mappedTo_4 = Pair.<String, VarianceInfo>of("String", VarianceInfo.IN);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_5 = this.operator_mappedTo(_mappedTo_4, VarianceInfo.OUT);
  Pair<String, VarianceInfo> _mappedTo_6 = Pair.<String, VarianceInfo>of("Integer", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_7 = this.operator_mappedTo(_mappedTo_6, VarianceInfo.INVARIANT);
  this.assertMapping(_assertMapping, "T2", _mappedTo_5, _mappedTo_7);
}
 
Example #23
Source File: ActualTypeArgumentCollectorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testUpperBound_02() {
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _mappedBy = this.mappedBy("T", "Iterable<? extends T>", "Iterable<? extends String>");
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.OUT);
  this.assertMapping(_mappedBy, "T", _mappedTo_1);
}
 
Example #24
Source File: BoundTypeArgumentMergerTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testArgumentTypeUsedTwice_05_b() {
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.IN);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.OUT);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("String", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.INVARIANT);
  this.to(this.merge(_mappedTo_1, _mappedTo_3), "String", null);
}
 
Example #25
Source File: ActualTypeArgumentCollectorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testBestEffortMapping_03() {
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _mappedBy = this.mappedBy("T", "java.util.ArrayList<T>", "Iterable<String>");
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.INVARIANT);
  this.assertMapping(_mappedBy, "T", _mappedTo_1);
}
 
Example #26
Source File: ActualTypeArgumentCollectorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testCircularTypeParams_13() {
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _mappedBy = this.mappedBy("T extends T2, T2 extends T", "T2", "String");
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.OUT);
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _assertMapping = this.assertMapping(_mappedBy, "T", _mappedTo_1);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.OUT);
  this.assertMapping(_assertMapping, "T2", _mappedTo_3);
}
 
Example #27
Source File: AssignabilityTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
@Override
public void testFunctionTypeAsParameterized_14() {
  this.isNotAssignableFrom(Pair.<String, String>of("(T)=>T", "T extends Integer"), "$Function1<Integer, Integer>");
  this.isNotAssignableFrom(Pair.<String, String>of("(T)=>T", "T extends Integer"), "$Function1<? super Integer, Integer>");
  this.isNotAssignableFrom(Pair.<String, String>of("(T)=>T", "T extends Integer"), "$Function1<Integer, ? extends Integer>");
  this.isNotAssignableFrom(Pair.<String, String>of("(T)=>T", "T extends Integer"), "$Function1<? super Integer, ? extends Integer>");
}
 
Example #28
Source File: HoverTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testHover_05() {
  final Procedure1<HoverTestConfiguration> _function = (HoverTestConfiguration it) -> {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("/**");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* Some documentation.");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("*/");
    _builder.newLine();
    _builder.append("type Foo {");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    Pair<String, String> _mappedTo = Pair.<String, String>of(("MyModel2." + this.fileExtension), _builder.toString());
    it.setFilesInScope(Collections.<String, CharSequence>unmodifiableMap(CollectionLiterals.<String, CharSequence>newHashMap(_mappedTo)));
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("type Bar extends Foo {");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    it.setModel(_builder_1.toString());
    it.setColumn("type Bar extends F".length());
    StringConcatenation _builder_2 = new StringConcatenation();
    _builder_2.append("[[0, 17] .. [0, 20]]");
    _builder_2.newLine();
    _builder_2.append("kind: markdown");
    _builder_2.newLine();
    _builder_2.append("value: Some documentation.");
    _builder_2.newLine();
    it.setExpectedHover(_builder_2.toString());
  };
  this.testHover(_function);
}
 
Example #29
Source File: BoundTypeArgumentMergerTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testArgumentTypeUsedTwice_02_a() {
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.INVARIANT);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.INVARIANT);
  this.to(this.merge(_mappedTo_1, _mappedTo_3), "String", VarianceInfo.INVARIANT);
}
 
Example #30
Source File: AssignabilityTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
@Override
public void testTwoTypeParameters_02() {
  this.isNotAssignableFrom(Pair.<String, String>of("Iterable<T>", "T, V extends T"), "Iterable<V>");
  this.isAssignableFrom(Pair.<String, String>of("Iterable<? extends T>", "T, V extends T"), "Iterable<V>");
  this.isAssignableFrom(Pair.<String, String>of("Iterable<? extends T>", "T, V extends T"), "Iterable<? extends V>");
}