Skip to content

Commit

Permalink
Include source file name in module-not-found error message.
Browse files Browse the repository at this point in the history
Fixes #2022.
  • Loading branch information
jkramer committed Jul 9, 2018
1 parent 032c6c0 commit 2d85f8a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Perl6/World.nqp
Expand Up @@ -1266,7 +1266,8 @@ class Perl6::World is HLL::World {
:auth-matcher(%opts<auth> // $true),
:api-matcher(%opts<api> // $true),
:version-matcher(%opts<ver> // $true),
:source-line-number($line)
:source-line-number($line),
:source-file-name(self.current_file)
);
self.add_object($spec);
my $registry := self.find_symbol(['CompUnit', 'RepositoryRegistry'], :setting-only);
Expand Down
1 change: 1 addition & 0 deletions src/core/CompUnit/DependencySpecification.pm6
@@ -1,6 +1,7 @@
class CompUnit::DependencySpecification {
has str $.short-name is required;
has int $.source-line-number = 0;
has str $.source-file-name = '';
has str $.from = 'Perl6';
has $.version-matcher = True;
has $.auth-matcher = True;
Expand Down
3 changes: 2 additions & 1 deletion src/core/Exception.pm6
Expand Up @@ -2958,9 +2958,10 @@ my class X::CompUnit::UnsatisfiedDependency is Exception {
method message() {
my $name = $.specification.short-name;
my $line = $.specification.source-line-number;
my $file = $.specification.source-file-name;
is-core($name)
?? "{$name} is a builtin type, not an external module"
!! "Could not find $.specification at line $line in:\n"
!! "Could not find $.specification at $file:$line in:\n"
~ $*REPO.repo-chain.map(*.Str).join("\n").indent(4)
~ ($.specification ~~ / $<name>=.+ '::from' $ /
?? "\n\nIf you meant to use the :from adverb, use"
Expand Down

0 comments on commit 2d85f8a

Please sign in to comment.