spockframework / spockframework/spock

Strange compile error when combining class and [] in where block

Open
#313 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Module-Core Type-Defect
Dominant language
Java
Stars
3.6k
Forks
483
PR merge metrics
No merged PRs in 30d

Description

Originally reported on Google Code with ID 191

Not sure whether this is a groovy compiler issue or spock issue. 

I get a compile error saying: "where-blocks may only contain certain parameterizations".
It happens when combining a class and empty list in a parameterized where block; e.g.
like this:

        where:
        theClass        | expectedResult
        Integer         | ["a"]  // works
        Integer.class   | ["a"]  // works
        Float           | []  // fails
        Float.class     | []  // fails
        Float           | new ArrayList() // works - i.e. a work-around

A complete spec reproducing compilation error is attached.

I am using Spock 0.6 snapshot with groovy 1.8

Reported by steinar.haugen on 2011-07-27 14:12:39


- _Attachment: [PossibleEmptyListBugSpecification.groovy](https://storage.googleapis.com/google-code-attachments/spock/issue-191/comment-0/PossibleEmptyListBugSpecification.groovy)_

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 attached PossibleEmptyListBugSpecification.groovy and reproduce the where-block compilation error using Spock 0.6 snapshot with Groovy 1.8. Inspect validation of parameterizations involving Float or Float.class and an empty list; done means those examples compile without the reported error and have regression coverage.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.