Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type inferencing for overloaded extension methods #1143

Closed
eric-milles opened this issue Jul 20, 2020 · 0 comments
Closed

Fix type inferencing for overloaded extension methods #1143

eric-milles opened this issue Jul 20, 2020 · 0 comments
Assignees
Labels
Milestone

Comments

@eric-milles
Copy link
Member

Consider the following:

Map<String, String> map = [foo:'bar']
assert map['foo'].toUpperCase() == 'BAR'

When executed, the runtime selects DefaultGroovyMethods#getAt(Object,String): Object for the subscript operation. However, the editor is inferring DefaultGroovyMethods#getAt(Map,Object): String and so "toUpperCase" is highlighted as an instance method of String. Since the return type is Object the method should be highlighted as unknown (underlined).

NOTE: There are separate issues filed to handle the oddities that result from having getAt(Object,String) and putAt(Object,String,Object) extension methods.

@eric-milles eric-milles added this to the v3.9.0 milestone Jul 20, 2020
@eric-milles eric-milles self-assigned this Jul 20, 2020
eric-milles added a commit that referenced this issue Jul 29, 2020
- disable code hover/select for map key
- highlight property expression as MAP_KEY
- propose only fields for "map.@x"
- propose only methods for "map.&x" or "map::x"
- propose only methods for "map.x" (no Java-bean variants)
- change inferred type of getAt(Object,String) extension method

#1143
eric-milles added a commit that referenced this issue Jul 30, 2020
- disable code hover/select for map key
- highlight property expression as MAP_KEY
- propose only fields for "map.@x"
- propose only methods for "map.&x" or "map::x"
- propose only methods for "map.x" (no Java-bean variants)
- change inferred type of getAt(Object,String) extension method

#1143
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant