Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.1
-
Fix Version/s: 1.8.5, 2.0-beta-2
-
Component/s: class generator
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
I would expect that range literal follow the same type promotion rules as arithmetic operations, yet:
assert (1+10).class == Integer assert (1L+10).class == Long assert (1+10L).class == Long assert (1..10).every { it.class == Integer } assert (1L..10).every { it.class == Long } assert (1..10L).every { it.class == Integer } // <= weird
Activity
Roshan Dawrani
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Assignee | Jochen Theodorou [ blackdrag ] | Roshan Dawrani [ roshandawrani ] |
Roshan Dawrani
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | 2.0-beta-2 [ 18072 ] | |
| Fix Version/s | 1.8.5 [ 18071 ] | |
| Resolution | Fixed [ 1 ] |
Paul King
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |
ObjectRange#constructorHelper(from, to) has the following piece commented out that should take care of this JIRA.
Is there any concern in aligning from / to types like this?
// TODO: Should we align to like types? // if (from instanceof Integer && to instanceof Long) { // from = Long.valueOf(((Integer) from).longValue()); // } else if (to instanceof Integer && from instanceof Long) { // to = Long.valueOf(((Integer) to).longValue()); // }