Ticket #1481 (new bug)

Opened 12 years ago

Last modified 11 years ago

P6metaclass.register does not catch second registration of PMC Class

Reported by: Austin_Hastings Owned by:
Priority: normal Milestone:
Component: none Version: 2.1.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description (last modified by Austin_Hastings) (diff)

Registering a PMC class works. Registering the same class a second time does not produce a diagnostic - although attempting to register a non-PMC class twice does.

Also, the second register produces some horrible results.

main();

sub main() {
	pir::load_bytecode('dumper.pbc');
	pir::load_bytecode('P6object.pbc');
	my $nsp;
	
	
	$nsp := Q:PIR {
		%r = get_hll_namespace ['Key']
	};
	_dumper($nsp);
	
	P6metaclass.register('Key');

	$nsp := Q:PIR {
		%r = get_hll_namespace ['Key']
	};
	_dumper($nsp);

	
	P6metaclass.register('Key');

	$nsp := Q:PIR {
		%r = get_hll_namespace ['Key']
	};
	_dumper($nsp);
}

Change History

Changed 12 years ago by Austin_Hastings

  • description modified (diff)

Changed 11 years ago by Austin

This bug is still present in 2.6. At this time, doubly-registering the namespace causes the namespace to be removed - get_root_namespace will return null.

Changed 11 years ago by NotFound

Here is a pure pir version of the example:

.sub main
    load_bytecode 'dumper.pbc'
    load_bytecode 'P6object.pbc'
    .local pmc r
    r = get_hll_namespace ['Key']
    _dumper(r)

    .local pmc P6metaclass
    P6metaclass = get_global 'P6metaclass'

    P6metaclass.'register'('Key')
    r = get_hll_namespace ['Key']
    _dumper(r)

    P6metaclass.'register'('Key')
    r = get_hll_namespace ['Key']
    _dumper(r)

.end
Note: See TracTickets for help on using tickets.