Wiki

Ticket #222 (closed defect: fixed)

Opened 14 years ago

Last modified 14 years ago

Bad attempt to declare constant causes COBRA INTERNAL ERROR - Null ref exception

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

Description

class Program

    var   a as int is shared
    const b = 2 * .a # OK error: The expression being assigned to "Program.A" must be constant
    const c = 2 * .b # OK
    const d = 2 * .e # COBRA INTERNAL ERROR

    def main
        pass

    get e as int is shared # BTW, same with or without shared.
        return 2

error: COBRA INTERNAL ERROR / NullReferenceException? / Object reference not set to an instance of an object

Attachments

var-initializer-bindint.patch Download (1.4 KB) - added by hopscc 14 years ago.

Change History

Changed 14 years ago by nevdelap

Actually, it's not just a const thing. It's initializing regular vars too.

Changed 14 years ago by hopscc

Changed 14 years ago by hopscc

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

missed binding.
patch, test and relnote.

Changed 14 years ago by Chuck

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

I think there could be deeper issues here, such as initializer expressions that create reference cycles and/or the interplay with generic declarations, but I'm certainly willing to accept the patch that improves the situation. Thanks for the report, Nev, and the patch, Hops.

Applied in changeset:2424

Note: See TracTickets for help on using tickets.