Skip to content
This repository

incorrect null-return from method calls #503

Open
plobsing opened this Issue January 03, 2011 · 3 comments

2 participants

Peter Lobsinger James E Keenan
Peter Lobsinger
Collaborator

Calling a method expecting one return value when the method returns none does not work as expected. The register should be filled with PMCNULL, or an exception should be thrown.

In stead, the register is filled with the invocant. While this allows for a nifty chaining accidental feature, this is not what is expected in these situations.

Originally http://trac.parrot.org/parrot/ticket/1929

Peter Lobsinger
Collaborator

492 byte attachment from plobsing
at http://trac.parrot.org/parrot/raw-attachment/ticket/1929/method-call.pir

```# Copyright (C) 2006-2009, Parrot Foundation.

$Id$

.sub 'main' :main
# set up filehandle
$P0 = new ['FileHandle']
$P0.'open'('/dev/null', 'w')
$P0.'puts'("null null null null null")

push_eh OK
    # expect incorrect number of parameters
    $P1 = $P0.'flush'() 
pop_eh
if_null $P1, OK

NOK:
say "not ok"
end

OK:
say "ok"
end
.end

Local Variables:

mode: pir

fill-column: 100

End:

vim: expandtab shiftwidth=4 ft=pir:

Peter Lobsinger
Collaborator

test for proper nullary method return behaviour (using FileHandle.flush)

James E Keenan
Owner

Can we get an update on the status of this ticket?

If the bug plobsing describes is real, then should we transform the patch into a test and TODO it?

Thank you very much.

kid51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.