Skip to content

TypeError: unsupported operand type(s) for +: 'NoneType' and 'int' when processing UVVM file #1533

@JHertz5

Description

@JHertz5

Environment
Head of branch issue-1531 (needed to parse the file correctly)
Git hash: b565fdd

Describe the bug
#1531 was raised because a UVVM file couldn't be parsed. Once the parsing error had been corrected (#1532), the file still couldn't be processed by VSG. It would crash with the following log output.

$ ./bin/vsg -f test.vhd -a
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/jhertzog/code/vhdl-style-guide-fork/bin/../vsg/apply_rules.py", line 126, in apply_rules
    oRules.check_rules(
  File "/home/jhertzog/code/vhdl-style-guide-fork/bin/../vsg/rule_list.py", line 229, in check_rules
    oRule.analyze(self.oVhdlFile)
  File "/home/jhertzog/code/vhdl-style-guide-fork/bin/../vsg/rule.py", line 147, in analyze
    lToi = self._get_tokens_of_interest(oFile)
  File "/home/jhertzog/code/vhdl-style-guide-fork/bin/../vsg/rules/multiline_structure.py", line 72, in _get_tokens_of_interest
    lMyReturn = remove_non_arrays(self.assignment_operator, lReturn)
  File "/home/jhertzog/code/vhdl-style-guide-fork/bin/../vsg/rules/multiline_structure.py", line 672, in remove_non_arrays
    if rules_utils.array_detected_after_assignment_operator(assignment_operator, oToi):
  File "/home/jhertzog/code/vhdl-style-guide-fork/bin/../vsg/rules/utils.py", line 422, in array_detected_after_assignment_operator
    if not open_paren_after_assignment_operator(assignment_operator, lTokens):
  File "/home/jhertzog/code/vhdl-style-guide-fork/bin/../vsg/rules/utils.py", line 457, in open_paren_after_assignment_operator
    return is_next_token_ignoring_whitespace(parser.open_parenthesis, iToken, lTokens)
  File "/home/jhertzog/code/vhdl-style-guide-fork/bin/../vsg/rules/utils.py", line 414, in is_next_token_ignoring_whitespace
    iToken = utils.find_next_non_whitespace_token(iToken + 1, lTokens)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/jhertzog/code/vhdl-style-guide-fork/./bin/vsg", line 16, in <module>
    main()
  File "/home/jhertzog/code/vhdl-style-guide-fork/bin/../vsg/__main__.py", line 154, in main
    for tResult in pool.imap(f, enumerate(commandLineArguments.filename)):
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 873, in next
    raise value
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

This indicates a type error in multiline structure rule processing.

To Reproduce
Steps to reproduce the behavior:

  1. Download the file mentioned above
  2. Run VSG with -a or --fix so that it doesn't stop after raising errors in the first phase.
  3. See error

Expected behavior
The tool should run completely without type errors.

Metadata

Metadata

Assignees

Labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions