Ticket #1073 (closed feature: fixed)

Opened 5 years ago

Last modified 4 years ago

Lexical redeclarations in subs should throw exceptions

Reported by: chromatic Owned by: kjs
Priority: normal Milestone:
Component: pirc Version: 1.6.0
Severity: medium Keywords: PIR
Cc: Language:
Patch status: Platform: all

Description

This code should throw an exception:

.sub 'main' :main
    .lex 'foo', $P0
    .lex 'bar', $P1
    .lex 'foo', $P2
.end

I'll add a TODO test for it in t/compilers/imcc/syn/clash.t when I get this ticket's number.

Please note that adding this exception to IMCC is fairly intractable without rewriting most of IMCC's symbol handling. I believe our best chance to make this work is with pirc.

Change History

Changed 5 years ago by kjs

Implemented in r42079 in PIRC. Not sure whether it's "wontfix" for IMCC (?).

Changed 4 years ago by plobsing

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

Fixed in r46449.

It detects the multiple definitions at the end of the sub, so the line number is slightly misleading; but it does tell you what you did and in which sub you did it, so I'm calling it "Good Enough"(TM).

Note: See TracTickets for help on using tickets.