Skip to content

Commit

Permalink
Fix crash when inheriting from an undeclared methodmap.
Browse files Browse the repository at this point in the history
Bug: issue #1000
Test: new test case
  • Loading branch information
dvander committed Nov 29, 2024
1 parent 76836e0 commit 329bf95
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/name-resolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1138,8 +1138,8 @@ bool MethodmapDecl::Bind(SemaContext& sc) {

auto& cc = sc.cc();
if (extends_) {
auto parent = FindSymbol(cc.globals(), extends_);
parent_ = MethodmapDecl::LookupMethodmap(parent);
if (auto parent = FindSymbol(cc.globals(), extends_))
parent_ = MethodmapDecl::LookupMethodmap(parent);
if (!parent_)
report(pos_, 102) << "methodmap" << extends_;
}
Expand Down
1 change: 1 addition & 0 deletions tests/compile-only/fail-inherit-undeclared-methodmap.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
methodmap A < B {}
1 change: 1 addition & 0 deletions tests/compile-only/fail-inherit-undeclared-methodmap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(1) : error 102: cannot find methodmap B

0 comments on commit 329bf95

Please sign in to comment.