Ticket #175 (closed defect: fixed)
Key in Dict gives silently incorrect /unexpected result
Reported by: | hopscc | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Cobra Compiler | Version: | 0.8.0 |
Keywords: | Cc: |
Description
Probably from changeset 2143
Now types dont match but silently fails..
class FKID def main is shared d = {'a':1, 'b':2, 'c':3, 'd':4} k = 'a' if k in d print 'has [k] in dict' else print 'no [k] in dict' if d.containsKey(k) print 'has key [k]' else print 'no key [k]' k ='x' if k in d print 'has [k]' else print 'no [k]' if d.containsKey(k) print 'has key [k]' else print 'no key [k]'
Result:
no a in dict has key a no x no key x
Probably need to trap this case and emit diagnostic
(if continuing down this path (:-))
Change History
Note: See
TracTickets for help on using
tickets.