Fix class extends dotted error (#6162)

This commit is contained in:
Igor Zaworski 2025-07-09 23:12:11 +02:00 committed by GitHub
parent 8b3a6ba542
commit dbfbc657e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 45 additions and 0 deletions

View File

@ -4233,6 +4233,7 @@ class LinkDotResolveVisitor final : public VNVisitor {
if (nodep->classOrNullp()) return;
LINKDOT_VISIT_START();
if (m_statep->forPrimary()) {
if (nodep->childDTypep()) return;
AstNode* cprp = nodep->classOrPkgsp();
VSymEnt* lookSymp = m_curSymp;
if (AstDot* const dotp = VN_CAST(cprp, Dot)) {

View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2025 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.compile()
test.execute()
test.passes()

View File

@ -0,0 +1,26 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2025 by Antmicro.
// SPDX-License-Identifier: CC0-1.0
class Class1 #(type T);
static function int get_p();
return 7;
endfunction
endclass
class Class2 #(type T) extends Class1 #(T);
static function int get_p2;
return T::get_p();
endfunction
endclass
module t;
initial begin
typedef Class2#(Class1#(int)) Class;
if (Class::get_p2() != Class1#(int)::get_p()) $stop;
$write("*-* All Finished *-*\n");
$finish;
end
endmodule