Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Test that we resolve code types in the setting.
So that users defining their own type that happens to be called Code,
Block, Regex and so forth will not find themselves in a pickle. If
there is real desire to override these, it is still possible, it just
needs a custom setting, which seems a fair trade-off.
  • Loading branch information
jnthn committed Dec 13, 2015
1 parent 688c43b commit 24bf700
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions S02-types/resolved-in-setting.t
@@ -0,0 +1,24 @@
use v6;
use Test;

plan 4;

# Shadow various code-object related types, and make sure we don't break
# everything. This test file will not compile if code object types and
# Parameter/Signature are not resolved by the compiler directly in the
# setting, instead of the usual lexical lookup.

my class Parameter { }
my class Signature { }
my class Code { }
my class Block { }
my class Routine { }
my class Sub { }
my class Method { }
my class Regex { }

is (-> $x { $x })(42), 42, 'Can use pointy block even with code types shadowed';
is (sub ($x) { $x })(42), 42, 'Can declare sub even with code types shadowed';
is class C { method m($x) { $x } }.m(42), 42, 'Can declare method even with code types shadowed';
# RT #126728
is 'abc' ~~ /\w/, 'a', 'Can use regex even with code types shadowed';

0 comments on commit 24bf700

Please sign in to comment.