Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should be able to fail() from a upper-case-return-type-constrained sub in Rakudo #941

Closed
p6rt opened this issue Apr 22, 2009 · 12 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Apr 22, 2009

Migrated from rt.perl.org#64990 (status was 'resolved')

Searchable as RT64990$

@p6rt
Copy link
Author

p6rt commented Apr 22, 2009

From @masak

<cspencer> rakudo​: our Int sub foo() { return fail() }; foo()
<p6eval> rakudo 04ee8d​: OUTPUT«Type check failed on return value [...]
<cspencer> should a fail() fail a type check in this case?
<jnthn> For upper-case types, I think not...
<jnthn> report as rakudobug
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Aug 13, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S04-exceptions/fail.t

commit 36252e8d1ee13f5a26aff7620bb65035f9d99a4e
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Thu Aug 13 03​:19​:04 2009 +0000

  [t/spec] Test for RT #​64990
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;27974 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S04-exceptions/fail.t b/t/spec/S04-exceptions/fail.t
index d9dcd1c..b91d860 100644
--- a/t/spec/S04-exceptions/fail.t
+++ b/t/spec/S04-exceptions/fail.t
@@ -2,7 +2,7 @@ use v6;
 
 use Test;
 
-plan 4;
+plan 5;
 
 # L<S04/Exceptions/The fail function>
 
@@ -31,4 +31,11 @@ plan 4;
   is $was_after_sub,  0, "fail() causes our try{} to die";
 }
 
+# RT #64990
+{
+    our Int sub rt64990 { return fail() }
+    #?rakudo skip 'RT #64990'
+    ok rt64990() ~~ Failure, 'sub typed Int can return Failure';
+}
+
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Aug 13, 2009

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Aug 19, 2009

From @jnthn

On Wed Apr 22 09​:57​:06 2009, masak wrote​:

<cspencer> rakudo​: our Int sub foo() { return fail() }; foo()
<p6eval> rakudo 04ee8d​: OUTPUT«Type check failed on return value [...]
<cspencer> should a fail() fail a type check in this case?
<jnthn> For upper-case types, I think not...
<jnthn> report as rakudobug
* masak submits rakudobug

Fixed in git 352acd2 and tests unfudged.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Aug 19, 2009

@jnthn - Status changed from 'open' to 'resolved'

@p6rt
Copy link
Author

p6rt commented Aug 31, 2012

@moritz - Status changed from 'resolved' to 'open'

@p6rt
Copy link
Author

p6rt commented Aug 31, 2012

From @moritz

In nom, prefix and --> return type constraints weren't implemented for
quite some time, which made the tests pass even though they shouldn't.

@p6rt
Copy link
Author

p6rt commented Mar 29, 2013

From @coke

On Fri Aug 31 12​:10​:54 2012, moritz wrote​:

In nom, prefix and --> return type constraints weren't implemented for
quite some time, which made the tests pass even though they shouldn't.

Currently failure mode of tests​:

14​:21 < [Coke]> r​: our Int sub foo { fail('a') }; say foo() ~~ Failure
14​:21 <+p6eval> rakudo 897636​: OUTPUT«a␤ in method sink at
  src/gen/CORE.setting​:10630␤ in method BUILDALL at
  src/gen/CORE.setting​:801␤ in method bless at
  src/gen/CORE.setting​:743␤ in method new at
  src/gen/CORE.setting​:728␤ in method new at
  src/gen/CORE.setting​:726␤ in sub foo at /tmp/Uu3wdrYiKc​:1…
14​:21 < moritz> sink bug
14​:21 < moritz> *sadface*

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Feb 17, 2015

From @coke

On Fri Mar 29 11​:23​:03 2013, coke wrote​:

On Fri Aug 31 12​:10​:54 2012, moritz wrote​:

In nom, prefix and --> return type constraints weren't implemented for
quite some time, which made the tests pass even though they shouldn't.

Currently failure mode of tests​:

14​:21 < [Coke]> r​: our Int sub foo { fail('a') }; say foo() ~~ Failure
14​:21 <+p6eval> rakudo 897636​: OUTPUT«a␤ in method sink at
src/gen/CORE.setting​:10630␤ in method BUILDALL at
src/gen/CORE.setting​:801␤ in method bless at
src/gen/CORE.setting​:743␤ in method new at
src/gen/CORE.setting​:728␤ in method new at
src/gen/CORE.setting​:726␤ in sub foo at /tmp/Uu3wdrYiKc​:1…
14​:21 < moritz> sink bug
14​:21 < moritz> *sadface*

This is now failing in a way very similar to the original bug report​:

$ ./perl6-m -e 'our Int sub foo() { return fail() }; foo()'
Type check failed for return value; expected 'Int' but got 'Failure'
  in any return_error at src/vm/moar/Perl6/Ops.nqp​:649
  in sub foo at -e​:1
  in block <unit> at -e​:1

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jun 23, 2015

From @peschwa

On Mon Feb 16 22​:11​:44 2015, coke wrote​:

On Fri Mar 29 11​:23​:03 2013, coke wrote​:

On Fri Aug 31 12​:10​:54 2012, moritz wrote​:

In nom, prefix and --> return type constraints weren't implemented
for
quite some time, which made the tests pass even though they
shouldn't.

Currently failure mode of tests​:

14​:21 < [Coke]> r​: our Int sub foo { fail('a') }; say foo() ~~
Failure
14​:21 <+p6eval> rakudo 897636​: OUTPUT«a␤ in method sink at
src/gen/CORE.setting​:10630␤ in method BUILDALL at
src/gen/CORE.setting​:801␤ in method bless at
src/gen/CORE.setting​:743␤ in method new at
src/gen/CORE.setting​:728␤ in method new at
src/gen/CORE.setting​:726␤ in sub foo at
/tmp/Uu3wdrYiKc​:1…
14​:21 < moritz> sink bug
14​:21 < moritz> *sadface*

This is now failing in a way very similar to the original bug report​:

$ ./perl6-m -e 'our Int sub foo() { return fail() }; foo()'
Type check failed for return value; expected 'Int' but got 'Failure'
in any return_error at src/vm/moar/Perl6/Ops.nqp​:649
in sub foo at -e​:1
in block <unit> at -e​:1

Failure has been special-cased in p6typecheckrv to always match type checks in Rakudo commit f1fa6445d8c7b46010443dcabed709aef150b78f. As mentioned in the commit message, jnthn++ has some concerns about inlineability of subs, but I can't see what to change how exactly. Roast commits f1fa6445d8c7b46010443dcabed709aef150b78f corrects a few tests that expect X​::TypeCheck​::Return to check for the now correct X​::Numeric​::DivideByZero instead, while f6461b3eca27c1a873b545ee23a04a327094c73 unfudges the existing tests in S04-exceptions/fail.t.

@p6rt
Copy link
Author

p6rt commented Jun 23, 2015

From @usev6

On Tue Jun 23 02​:43​:41 2015, peschwa@​gmail.com wrote​:

On Mon Feb 16 22​:11​:44 2015, coke wrote​:

On Fri Mar 29 11​:23​:03 2013, coke wrote​:

On Fri Aug 31 12​:10​:54 2012, moritz wrote​:

In nom, prefix and --> return type constraints weren't
implemented
for
quite some time, which made the tests pass even though they
shouldn't.

Currently failure mode of tests​:

14​:21 < [Coke]> r​: our Int sub foo { fail('a') }; say foo() ~~
Failure
14​:21 <+p6eval> rakudo 897636​: OUTPUT«a␤ in method sink at
src/gen/CORE.setting​:10630␤ in method BUILDALL at
src/gen/CORE.setting​:801␤ in method bless at
src/gen/CORE.setting​:743␤ in method new at
src/gen/CORE.setting​:728␤ in method new at
src/gen/CORE.setting​:726␤ in sub foo at
/tmp/Uu3wdrYiKc​:1…
14​:21 < moritz> sink bug
14​:21 < moritz> *sadface*

This is now failing in a way very similar to the original bug report​:

$ ./perl6-m -e 'our Int sub foo() { return fail() }; foo()'
Type check failed for return value; expected 'Int' but got 'Failure'
in any return_error at src/vm/moar/Perl6/Ops.nqp​:649
in sub foo at -e​:1
in block <unit> at -e​:1

Failure has been special-cased in p6typecheckrv to always match type
checks in Rakudo commit f1fa6445d8c7b46010443dcabed709aef150b78f. As
mentioned in the commit message, jnthn++ has some concerns about
inlineability of subs, but I can't see what to change how exactly.
Roast commits f1fa6445d8c7b46010443dcabed709aef150b78f corrects a few
tests that expect X​::TypeCheck​::Return to check for the now correct
X​::Numeric​::DivideByZero instead, while
f6461b3eca27c1a873b545ee23a04a327094c73 unfudges the existing tests in
S04-exceptions/fail.t.

I'm closing this ticket as 'resolved'.

@p6rt
Copy link
Author

p6rt commented Jun 23, 2015

@usev6 - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jun 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant