Wiki

Ticket #344 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

Compiler chokes on newline between property doctstring and body

Reported by: Jonno Owned by:
Priority: minor Milestone:
Component: Cobra Compiler Version: 0.9.4
Keywords: Cc:

Description

Apologies if this is known / by design - this is my first day with Cobra.

Working through the howto, I producted the following code:

class Person

    var _name as String

    cue init(name as String)
        base.init
        _name = name

    pro name as String
        """
        Name of the Person. 
        """
        
        get
            return _name
        set
            _name = value.trim

    def printName
        print .name

    def sayHello
        print 'Hi, my name is [.name]'

class Program
    def main
        p = Person('chuck')
        print p.name
        assert p.name == 'chuck'
        p.name = 'Chuck'

which caused the compiler to produce:

error: Expecting "get" or "set" for the property.

which is seemingly due to the newline following the docblock in the name property.

Removing the newline allows the code to compile, but this feels strange as the limitation does not seem to be in place for classes or methods.

Change History

Changed 4 years ago by Charles

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

Not known or by design. Just hasn't come up before as it's an uncommon spacing style.

Fixed in changeset:3038

Thanks for taking the time to put in a report.

Note: See TracTickets for help on using tickets.