Fix method calls without parenthesis (#6127).

This commit is contained in:
Wilson Snyder 2025-06-26 18:16:21 -04:00
parent 68e1ed55f6
commit e422c183ff
7 changed files with 50 additions and 6 deletions

View File

@ -78,6 +78,7 @@ Verilator 5.037 devel
* Fix decoding octal string escapes with 1-2 digits (#6108).
* Fix colon-divide operator without space (#6121). [Alex Solomatnikov]
* Fix variables declared in fork after taskify (#6126). [Kamil Rakoczy, Antmicro Ltd.]
* Fix method calls without parenthesis (#6127). [Alex Solomatnikov]
Verilator 5.036 2025-04-27

View File

@ -3123,9 +3123,13 @@ class LinkDotResolveVisitor final : public VNVisitor {
expectWhat = "scope/variable";
allowScope = true;
allowVar = true;
} else if (m_ds.m_dotPos == DP_NONE || m_ds.m_dotPos == DP_FINAL) {
} else if (m_ds.m_dotPos == DP_NONE) {
expectWhat = "variable";
allowVar = true;
} else if (m_ds.m_dotPos == DP_FINAL) {
expectWhat = "variable/method";
allowFTask = true;
allowVar = true;
} else {
UINFO(1, "ds=" << m_ds.ascii());
nodep->v3fatalSrc("Unhandled VParseRefExp");

View File

@ -5,10 +5,10 @@
%Error: t/t_fallback_bad.v:27:15: Can't find definition of task/function: 'tsk'
27 | this.tsk;
| ^~~
%Error: t/t_fallback_bad.v:28:16: Can't find definition of variable: 'f'
%Error: t/t_fallback_bad.v:28:16: Can't find definition of variable/method: 'f'
28 | super.f = 8;
| ^
%Error: t/t_fallback_bad.v:29:15: Can't find definition of variable: 'f'
%Error: t/t_fallback_bad.v:29:15: Can't find definition of variable/method: 'f'
29 | this.f = 8;
| ^
%Error: t/t_fallback_bad.v:30:20: Can't find definition of 'tsk' in dotted task/function: 'sub1.sub2.tsk'
@ -21,7 +21,7 @@
%Error: t/t_fallback_bad.v:32:15: Can't find definition of task/function: 'tsk'
32 | pkg::tsk();
| ^~~
%Error: t/t_fallback_bad.v:33:20: Can't find definition of 'f' in dotted variable: 'sub1.sub2.f'
%Error: t/t_fallback_bad.v:33:20: Can't find definition of 'f' in dotted variable/method: 'sub1.sub2.f'
33 | sub1.sub2.f = 8;
| ^
%Error: t/t_fallback_bad.v:34:20: Can't find definition of 'f' in dotted scope/variable: 'sub1.sub2.f'

View File

@ -0,0 +1,16 @@
#!/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('linter')
test.lint()
test.passes()

View File

@ -0,0 +1,23 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2025 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
package pkg;
class tb_cpu_seq_item;
virtual function void uvm_report_error(string message);
$display("%s", message);
endfunction
virtual function string get_type_name();
return "GTN";
endfunction
virtual function bit do_compare( tb_cpu_seq_item rhs, int comparer);
uvm_report_error($sformatf("this is of type %s, rhs is of type %s", this.get_type_name(), rhs.get_type_name()));
uvm_report_error($sformatf("this is of type %s, rhs is of type %s", this.get_type_name, rhs.get_type_name));
endfunction
endclass
endpackage
module t;
endmodule

View File

@ -1,4 +1,4 @@
%Error: t/t_fuzz_always_bad.v:10:15: Can't find definition of 'a' in dotted variable: 'c.a'
%Error: t/t_fuzz_always_bad.v:10:15: Can't find definition of 'a' in dotted variable/method: 'c.a'
10 | always @ c.a c:h;
| ^
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.

View File

@ -2,7 +2,7 @@
9 | $display("a=", missing.a);
| ^~~~~~~
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
%Error: t/t_inst_missing_dot_bad.v:9:30: Can't find definition of 'a' in dotted variable: 'missing.a'
%Error: t/t_inst_missing_dot_bad.v:9:30: Can't find definition of 'a' in dotted variable/method: 'missing.a'
9 | $display("a=", missing.a);
| ^
%Error: Exiting due to