VerifyError in Clojure 1.8.0-(beta1..RC1)

Description

Nicola Mometto provided the below minimal repro case:

Full stack trace as found with https://github.com/kumarshantanu/asphalt:

Environment

Oracle JDK 1.7, Oracle JDK 1.8 on Mac OS X

Activity

Show:

import November 12, 2015 at 2:59 AM

Comment made by: kumarshantanu

I tested with the latest master and it correctly reports the "Caused by: java.lang.UnsupportedOperationException: Cannot coerce long to int, use a cast instead" error now. However, the reported line number in the exception is that of the defn (first line of the fn) instead of where the coercion was attempted in the fn body.

Alex Miller November 11, 2015 at 9:20 PM

The commit makes this kind of incorrect type hint (previously a no op) now a compile error.

Alex Miller November 11, 2015 at 9:20 PM

Alex Miller November 11, 2015 at 9:18 PM

The example Nicola gave in the description worked in 1.6 and 1.7 and 1.8 up to 1.8.0-alpha2. It started failing as of https://github.com/clojure/clojure/commit/8c9580cb6706f2dc40bb31bbdb96a6aefe341bd5 for CLJ-1533.

Nicola Mometto November 11, 2015 at 2:23 PM

Copying a comment I posted on the ML regarding this bug:

To be honest I'm not sure this should even be a valid use of type hints.
You're telling the compiler that the result of (foo) is an int, when it is infact a long.

The correct way to do this should be:

Again, lack of specification on what the correct type hinting semantics should be make it hard to evaluate if this should be considered a bug or just an user error that previously just got ignored.

Completed

Details

Assignee

Reporter

Approval

Vetted

Priority

Affects versions

Fix versions

Created November 11, 2015 at 12:07 PM
Updated November 12, 2015 at 2:59 AM
Resolved November 12, 2015 at 2:59 AM