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

Less than awesome error message for failed assignment type checks on subtypes in Rakudo #1120

Closed
p6rt opened this issue Jul 6, 2009 · 8 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 6, 2009

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

Searchable as RT67256$

@p6rt
Copy link
Author

p6rt commented Jul 6, 2009

From @masak

<masak> rakudo​: subset Positive of Num where { $^n > 0 }; my Positive
$p; $p = -42
<p6eval> rakudo 0e8a86​: OUTPUT«Assignment type check failed; expected
, but got Int [...]
* masak submits rakudobug
<jnthn> bug?
<jnthn> oh, less than awesome error message
<masak> aye.

@p6rt
Copy link
Author

p6rt commented Jul 22, 2009

From @masak

<masak> rakudo​: subset Positive of Num where { $^n > 0 }; my Positive
$p; $p = -42
<p6eval> rakudo 5901f2​: OUTPUT«Assignment type check failed; expected
, but got Int [...]
<masak> I don't think I ever reported this one.
<masak> it's a "less than awesome error message" bug
* masak reports it now

@p6rt
Copy link
Author

p6rt commented Aug 8, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S02-polymorphic_types/subset.t

commit c1b879f2c8688410bf87081759a082bb80806eb7
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sat Aug 8 01​:43​:04 2009 +0000

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

Inline Patch
diff --git a/t/spec/S02-polymorphic_types/subset.t b/t/spec/S02-polymorphic_types/subset.t
index b821643..3a75de6 100644
--- a/t/spec/S02-polymorphic_types/subset.t
+++ b/t/spec/S02-polymorphic_types/subset.t
@@ -1,6 +1,6 @@
 use v6;
 use Test;
-plan 29;
+plan 31;
 
 =begin description
 
@@ -120,4 +120,16 @@ eval_dies_ok 'my Digit $x = 3.1',
             'subset of Str where pattern in braces enforces pattern';
 }
 
+# RT #67786
+{
+    subset RT67786 of Int where { $^i > 0 }
+    my RT67786 $rt67786;
+
+    try { $rt67786 = -42 }
+
+    ok  $!  ~~ Exception, 'subset of Int enforces where clause';
+    #?rakudo todo 'RT #67786'
+    ok "$!" ~~ / RT67786 /, 'error for bad assignment mentions subset';
+}
+
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Aug 8, 2009

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

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

@coke - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 11, 2011

From @bbkr

NOM

bbkr​:nom bbkr$ ./perl6 -e 'subset Positive of Num where { $^n > 0 }; my
Positive $p; $p = -42'
Type check failed in assignment to '$p'; expected 'Positive' but got 'Int'

checking tests...

@p6rt
Copy link
Author

p6rt commented Sep 11, 2011

From @bbkr

Mentioned tests are unfudged and passing.

@p6rt
Copy link
Author

p6rt commented Sep 11, 2011

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

@p6rt p6rt closed this as completed Sep 11, 2011
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant