<commit_before>use v6;
use Test;

plan 7;

class Foo0 { has Int:_ $.bar }
is Foo0.new.bar, Int, 'Int:_ on attribute without initializer';

class Foo1 { has Int:_ $.bar = 0 }
is Foo1.new.bar, 0, 'Int:_ on attribute with initializer';

throws-like 'class Foo2 { has Int:D $.bar }',
    X::Syntax::Variable::MissingInitializer,
    type => 'Int:D',
    'Int:D on attribute wíthout initializer throws';

class Foo3 { has Int:D $.bar = 1 }
is Foo3.new.bar, 1, 'Int:D on attribute with initializer';

class Foo4 { has Int:U $.bar }
ok Foo4.new.bar ~~ Int, 'Int:U on attribute without initializer';

class Foo5 { has Int:U $.bar = IntStr }
ok Foo5.new.bar ~~ Int, 'Int:U on attribute with initializer';

{
    use attributes :D;
    #?rakudo todo 'attributes pragma NYI'
    throws-like 'class Foo6 { has Int $.bar }',
        X::Syntax::Variable::MissingInitializer,
        type => 'Int:D',
        'Int:D on attribute wíthout initializer throws';
}

# vim: ft=perl6<commit_msg>Unfudge now passing test<commit_after>use v6;
use Test;

plan 7;

class Foo0 { has Int:_ $.bar }
is Foo0.new.bar, Int, 'Int:_ on attribute without initializer';

class Foo1 { has Int:_ $.bar = 0 }
is Foo1.new.bar, 0, 'Int:_ on attribute with initializer';

throws-like 'class Foo2 { has Int:D $.bar }',
    X::Syntax::Variable::MissingInitializer,
    type => 'Int:D',
    'Int:D on attribute wíthout initializer throws';

class Foo3 { has Int:D $.bar = 1 }
is Foo3.new.bar, 1, 'Int:D on attribute with initializer';

class Foo4 { has Int:U $.bar }
ok Foo4.new.bar ~~ Int, 'Int:U on attribute without initializer';

class Foo5 { has Int:U $.bar = IntStr }
ok Foo5.new.bar ~~ Int, 'Int:U on attribute with initializer';

{
    throws-like 'use attributes :D; class Foo6 { has Int $.bar }',
        X::Syntax::Variable::MissingInitializer,
        type => 'Int (with implicit :D)',
        'Int:D on attribute wíthout initializer throws';
}

# vim: ft=perl6
{'fraction_non_alphanumeric': 0.1421161825726141, 'fraction_numerical': 0.01970954356846473, 'mean_word_length': 3.592857142857143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3063913', 'n_tokens_mistral': 706, 'n_tokens_neox': 672, 'n_words': 228}