Wiki

Ticket #244 (new defect)

Opened 14 years ago

Cobra gets itself into a state where it puts single quotes around all the strings it is outputting.

Reported by: nevdelap Owned by:
Priority: minor Milestone:
Component: Cobra Compiler Version: 0.8.0
Keywords: Cc:

Description

These is reproducible in my app while running its tests, but I haven't managed to boil it down into something small enough to post to demonstrate the problem. When I manage that I'll add it to the ticket.

This mickey mouse little toString, where I'd put a print and a couple of traces...

    def toString as String is override
      and ensure
        result <> ''
      body
        print '--------------'
        s = _name
        trace _name, _type
        if _type <> ''
          s += ':[_type]'
        trace s
        return s

Produces this output when running my tests. You'll see that the first three times it is called it prints correctly, then subsequently it is adding lots of extra quotes around everything it is outputing - not just around my _name and _type strings, so it's not that they have garbage in them.

--------------
    trace: _name='def'; _type='int'; at Parameter.cobra:67; in Parameter.toString
    trace: s='def:int'; at Parameter.cobra:70; in Parameter.toString
--------------
    trace: _name='abc'; _type=''; at Parameter.cobra:67; in Parameter.toString
    trace: s='abc'; at Parameter.cobra:70; in Parameter.toString
--------------
    trace: _name='def'; _type='int'; at Parameter.cobra:67; in Parameter.toString
    trace: s='def:int'; at Parameter.cobra:70; in Parameter.toString
        << test 1: .toString_ol_1_11581
        >> test 2: .parse_ol_1_11744
'--------------'
    trace: '_name'=''abc'''; ''_type'='''''; 'at 'Parameter.cobra':67'; 'in 'Parameter'.'toString'
    trace: 's'=''abc'''; 'at 'Parameter.cobra':70'; 'in 'Parameter'.'toString'
'--------------'
    trace: s='abc'; at Parameter.cobra:77; in Parameter.parse
    trace: s='zyx:int'; at Parameter.cobra:77; in Parameter.parse
'--------------'
    trace: '_name'=''abc'''; ''_type'='''''; 'at 'Parameter.cobra':67'; 'in 'Parameter'.'toString'
    trace: 's'=''abc'''; 'at 'Parameter.cobra':70'; 'in 'Parameter'.'toString'
'--------------'
    trace: '_name'=''zyx'''; ''_type'=''int'''; 'at 'Parameter.cobra':67'; 'in 'Parameter'.'toString'
    trace: 's'=''zyx:'int''''; 'at 'Parameter.cobra':70'; 'in 'Parameter'.'toString'

What triggers it is a line elsewhere also added just for debugging...

  print visibility, name, parameters, type

in the parse method being tested when the next four calls to it produce the other four outputs, where Visibility is an enum, name and type are strings, and parameters is a list of Parameter, the class with the above toString method.

So I'll try to come up with something small that demonstrates the whole problem, which I've been trying to do for while without success so far - but I thought I'd flag it in a ticket, and maybe from this output you might have a inkling.

Note: See TracTickets for help on using tickets.