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

Binding / bound variables don't honor binder variable's type constraint #5109

Open
p6rt opened this issue Jan 31, 2016 · 4 comments
Open

Binding / bound variables don't honor binder variable's type constraint #5109

p6rt opened this issue Jan 31, 2016 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jan 31, 2016

Migrated from rt.perl.org#127443 (status was 'open')

Searchable as RT127443$

@p6rt
Copy link
Author

p6rt commented Jan 31, 2016

From @raiph

Reporting an apparent bug pointed out by Christoph at http://stackoverflow.com/a/35002979/1077672

This is Rakudo version 2015.12-213-g770d109 built on MoarVM version 2015.12-29-g8079ca5
implementing Perl 6.c.

What I did

my Int $a;
my $b = 42;
$a := $b;
$b = "not Int";
say $a;
$a = "not Int";
say $a;
$a := "not Int";

What I got

not cool
not cool
Type check failed in binding; expected Int but got Str
  in block <unit> at -e line 1

What I "expected"

That $b's type constraints have to be the same as or more narrow than $a's type constraints for the binding `$a := $b` to succeed.

So something like​:

===SORRY!=== Error while compiling ...
Type check failed in binding; expected Int but got Mu

@p6rt
Copy link
Author

p6rt commented Jul 2, 2016

From @raiph

What I got

Should of course have been​:

not Int
not Int
Type check failed in binding; expected Int but got Str ("not Int")

@p6rt
Copy link
Author

p6rt commented Aug 1, 2016

From @zoffixznet

Still present in today's Rakudo fa84f1

--
Cheers,
ZZ | https://twitter.com/zoffix

@p6rt
Copy link
Author

p6rt commented Aug 23, 2016

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

@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