Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.0.0m2
-
Fix Version/s: None
-
Component/s: Content Assist, Editor, Inferencing Engine
-
Labels:
-
Number of attachments :
Description
In this code:
def h = [:]
h.foo = "value"
print h.foo
Both references of 'foo' are underlined, but they should not be. Also, 'foo' does not appear in content assist, but it should.
Grails uses this kind of map accessing extensively, and so it should be fixed.
I'm not sure of the best way forward here. There are several ways to fix this:
- Assume all references that have an object type of Map, are ok and have a type of Object. This remove the underlining above, but will not help with content assist. Also, this will mask truly incorrect references. However, it is very easy to implement.
- Locally keep track of all assignments to map references and remember the types of the values. This will help in the above code, but will not help if the map value is assigned non-locally.
- Do a combination of both. Any map reference not currently remembered is considered OK, and if it is remembered, then use the stored type. Again, this will mask truly incorrect references.
Think about this post 2.0