Ticket #170 (closed defect: fixed)
Multitarget assignment does not infer types of cast expressions
Reported by: | Chuck | Owned by: | Chuck |
---|---|---|---|
Priority: | major | Milestone: | Cobra 0.9 |
Component: | Cobra Compiler | Version: | 0.8.0 |
Keywords: | Cc: |
Description
This program should work, but gives two errors:
class X def main a = 'aoeu' to Object b = 5 to Object x, y = a to String, b to int assert x.length == 4 assert y * 2 == 10
The errors:
(6): error: Cannot find a definition for "length" in "x" whose type is "Object". (7): error: Cannot apply STAR to Object and int. Try finding a method that performs this function.
It seems that x and y are inferred as Object instead of the types that the right hand expressions are cast to.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.