Skip to content

Commit

Permalink
Revert "An object will never work if native is expected" (#4829)
Browse files Browse the repository at this point in the history
This reverts commit 73d5e74.

That commit turned out to be incorrect. For more background see

  #4823

My reasoning back then was that a compile time error would be a good
thing to have. But firstly, I didn't consider that the error message
could be inappropriate, talking about Mu in examples like this:

  $ raku -e 'multi f(int $i) { $i + $i }; my $a = 2; say f $a'
  ===SORRY!=== Error while compiling -e
  Calling foo(Mu) will never work with any of these multi signatures:
      (int $i)
  [...]

But even worse: There are cases where the types *could* match at
runtime, like here (should print "4"):

  $ raku -e 'multi f(int $i) { $i + $i }; my $a = 3; my int $b = 2; $a := $b; say f $a'
  • Loading branch information
usev6 committed Mar 23, 2022
1 parent 75370b7 commit 94d4820
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/Perl6/bootstrap.c/BOOTSTRAP.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -3323,7 +3323,6 @@ BEGIN {
if $got_prim == $BIND_VAL_OBJ {
# Object; won't do.
$type_mismatch := 1;
$type_match_possible := 0;
last;
}

Expand Down

0 comments on commit 94d4820

Please sign in to comment.