Wiki

Ticket #264 (closed defect: fixed)

Opened 14 years ago

Last modified 12 years ago

False compilation error for complex expression

Reported by: Charles Owned by: Chuck
Priority: major Milestone:
Component: Cobra Compiler Version: 0.8.0
Keywords: Cc:

Description

An expression that indexes a list of types, instantiates the type and then invokes a method, fails with a false compilation error:

class A
    def blah
        print "A!"
  
class B
    def blah
        print "B!"
  
class C
    def blah
        print "C!"


class Program
    def main
        myList = [A, B, C]
        for i, type in myList.numbered
            # This works:
            type = myList[i]
            type().blah
            # This fails at compile time:
            myList[i]().blah

Reported by Dr_Asik in the forums at
 http://cobra-language.com/forums/viewtopic.php?f=4&t=699#p3632

Attachments

tkt264.patch Download (3.1 KB) - added by hopscc 12 years ago.

Change History

Changed 12 years ago by hopscc

Changed 12 years ago by hopscc

  • owner set to Chuck
  • status changed from new to assigned

Fixup codegen for this case (indexer), refactor to remove some dup code.
Add above as a new test.

Changed 12 years ago by Charles

  • status changed from assigned to closed
  • resolution set to fixed

Thanks for the patch. changeset:2972

Changed 12 years ago by hopscc

Whats a delimeter ?
(deli-meter - that thing that you pickup a ticket from for service to collect your processed meat and dairy product) (:-)

s/delimeter/delimiter/g

Note: See TracTickets for help on using tickets.