fparser icon indicating copy to clipboard operation
fparser copied to clipboard

Renamed imports clash with local symbols

Open ZedThree opened this issue 3 years ago • 0 comments
trafficstars

The following test fails:

def test_module_redefinition(f2003_parser):
    '''Check that local names don't clash with renamed imported symbols'''
    _ = f2003_parser(get_reader('''\
module my_mod
  use some_mod, only: b => a
  real :: a
end module my_mod
    '''))
    tables = SYMBOL_TABLES
    assert list(tables._symbol_tables.keys()) == ["my_mod"]
    table = tables.lookup("my_mod")
    assert isinstance(table, SymbolTable)
    assert "some_mod" in table._modules
    assert "a" in table._data_symbols
    sym = table.lookup("a")
    assert sym.name == "a"
    assert sym.primitive_type == "real"

with:

parser.two.symbol_table.SymbolTableError: Symbol table already contains a use of a symbol named 'a' from module 'some_mod'

ZedThree avatar Apr 28 '22 14:04 ZedThree