groovy / groovy/groovy-eclipse

Fix type inferencing for multi-level spread-dot operator

Open
#813 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
681
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Consider the following:

def strings = [['1','2','3'], ['4','5','6']]
def spread1 = strings*.length()

def table = new Hashtable<String,Integer>()
table.put('a', 1)
table.put('b', 2)
table.put('c', 3)
def spread2 = [table.values()]*.value // "value" refers to the field of java.lang.Integer

Code hover (F2) on spread1 yields List<List<E>> when it should be List<List<Integer>>. Similarly, spread2 infers as List<Collection<E>> when it should be List<Collection<Integer>>.

Contributor guide

No contributing guide indexed for this repository

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

Reproduce the issue with the spread1 and spread2 examples, then start at the code-hover (F2) type-inferencing path for the multi-level spread-dot operator. Trace how the element types are resolved; done means the hovers report List<List> and List<Collection> respectively.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.