Skip to content

Capitalization by function_508 has undesired side effects #1482

@adsclelann

Description

@adsclelann

Environment
VSG 3.33.0 on Fedora 32.

Describe the bug
When a record field has the same name than a function parameter, it is improperly affected by function_508.

To Reproduce
Use the following VHDL file:

library ieee;
use ieee.std_logic_1164.all;

package bug_function_508_pkg is

	type t is record
		PARAM : std_logic;
	end record;

	function f (a : t; param : std_logic) return std_logic;

end package;

package body bug_function_508_pkg is

	function f (param : std_logic) return t is
		variable r : t;
	begin
		r := (
			PARAM => param
		);
		return r;
	end function;

end package body;

With this configuration:

linesep: "\n"

rule:
  global:
    disable: true
    fixable: false

  function_508:
    disable: false
    fixable: true

VSG considers than the "PARAM" (record field) should be set as lowercase, because the function parameter "param" was defined as lowercare.

Expected behavior
Focus on the function parameters, and leave the rest to their dedicated rules.

Screenshots

================================================================================
File:  bug_function_508.vhd
================================================================================
Phase 6 of 7... Reporting
Total Rules Checked: 1
Total Violations:    1
  Error   :     1
  Warning :     0
---------------+------------+------------+--------------------------------------
  Rule         |  severity  |  line(s)   | Solution
---------------+------------+------------+--------------------------------------
  function_508 | Error      |         20 | Parameter case mismatch:  Change PARAM to param
---------------+------------+------------+--------------------------------------

Thanks you for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions