eclipse-xtext / eclipse-xtext/xtext

Compile error inside lambda expression

Open
#2,298 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug confirmed
Dominant language
Java
Stars
831
Forks
330
Avg merge
3d 7h
Merged PRs (30d)
12

Description

The Xtend converter converts the following valid Java code

@Test public void conditionTest() { assertThat(new ArrayList<BigDecimal>()).are(new Condition<>(decimal -> decimal.scale() == 1, "")).isEmpty(); } }

to the following Xtend code

@Test def void conditionTest() { assertThat(new ArrayList<BigDecimal>()).are(new Condition([decimal|decimal.scale() === 1], "")).isEmpty() }

which shows a compile error at the call to scale().

Eclipse IDE Version: Oxygen Release (4.7.0) Build id: 20170620-1800
Xtend IDE: 2.12.0.v20170519-1412
OS: Arch Linux
OpenJDK Runtime Environment (build 1.8.0_144-b01)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Java and Xtend snippets in the issue and trace the Xtend conversion of the lambda passed to Condition. Reproduce the compile error in the stated Eclipse/Xtend environment, then verify that the converted code can call scale() and compiles successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.