Skip to content

Commit

Permalink
RakuAST: make single part setting lookups work
Browse files Browse the repository at this point in the history
The multi-part one still fails, but that's code in the resolver that
will need closer scrutiny
  • Loading branch information
lizmat committed Mar 22, 2023
1 parent 9ef618f commit bc48133
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/Raku/ast/type.rakumod
Expand Up @@ -76,12 +76,18 @@ class RakuAST::Type::Simple
}
}

# A simple type name, e.g. Int, Foo::Bar, etc. that should be looked up in the
# A simple type name, e.g. Int, IO::Path, etc. that should be looked up in the
# setting.
class RakuAST::Type::Setting
is RakuAST::Type::Simple
{
# TODO limit lookup to setting
method resolve-with(RakuAST::Resolver $resolver) {
my $resolved := $resolver.resolve-name-constant-in-setting(self.name);
if $resolved {
self.set-resolution($resolved);
}
Nil
}
}

class RakuAST::Type::Derived
Expand Down
1 change: 0 additions & 1 deletion t/12-rakuast/types.rakutest
Expand Up @@ -140,7 +140,6 @@ subtest 'Single-part type from the setting' => {
my \SETTING-Date := Date;
for 'AST', $ast, 'Str', $deparsed, 'Raku', EVAL($raku) -> $type, $it {
my class Date { }
todo "no actual lookup in SETTING only yet";
is-deeply EVAL($it), SETTING-Date,
"$type: did we get the setting version";
}
Expand Down

0 comments on commit bc48133

Please sign in to comment.