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

X::AdHoc instead of X::TypeCheck::Binding with subset parameter #4800

Open
p6rt opened this issue Nov 29, 2015 · 4 comments
Open

X::AdHoc instead of X::TypeCheck::Binding with subset parameter #4800

p6rt opened this issue Nov 29, 2015 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Nov 29, 2015

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

Searchable as RT126763$

@p6rt
Copy link
Author

p6rt commented Nov 29, 2015

From carsten.hartenfels@googlemail.com

This bug is for rakudo version 2015.11-283-g0ede335 built on MoarVM
version 2015.11-21-g469ba64 implementing Perl v6.b.

Take the following code​:

  subset Empty of Str where /^$/;

  say "assignment​:";
  try my Empty $x = "a";
  say $!.message;
  say $!.^name;

  say "binding​:";
  sub f(Empty $) {}
  try f("a");
  say $!.message;
  say $!.^name;

This outputs​:

  assignment​:
  Type check failed in assignment to $x; expected Empty but got Str
  X​::TypeCheck​::Assignment
  binding​:
  Constraint type check failed for parameter '<anon>'
  X​::AdHoc

The X​::AdHoc is wrong I think, it should be a X​::TypeCheck​::Binding,
analogous to the assignment.

Using a non-subset type also works correctly, if you can get it through
the compiler saying it'll never work​:

  sub g(Str $) {}
  try g(False ?? "" !! 1); # thwart compiler
  say $!.message;
  say $!.^name;

Outputs​:

  Type check failed in binding <anon>; expected Str but got Int
  X​::TypeCheck​::Binding

@p6rt
Copy link
Author

p6rt commented Oct 20, 2016

From @briandfoy

Should the type of exception be X​::TypeCheck​::Argument? (Found in src/core/Exception.pm)

@p6rt
Copy link
Author

p6rt commented Oct 20, 2016

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

@p6rt
Copy link
Author

p6rt commented Oct 20, 2016

From @briandfoy

On Thu Oct 20 10​:10​:42 2016, comdog wrote​:

Should the type of exception be X​::TypeCheck​::Argument? (Found in
src/core/Exception.pm)

Also there's the stackoverflow thread​: http://stackoverflow.com/q/40097868/2766176

@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