Skip to content

New semantic analyzer: create dummy symbol table nodes for incomplete things #6299

Closed
@JukkaL

Description

@JukkaL

Currently we don't create any node if a definition has incomplete dependencies. This is a problem, since this can result in incorrectly falling to the a different namespace. Example:

from m import ord  # Assume that this is incomplete, but m.ord is a class

x: ord  # Now this falls back to builtins.ord instead of m.ord, 
        # which may generate a bogus error

We should be able to fix this by adding dummy nodes to the symbol table in case we can't bind to the actual node.

Notes:

  • On subsequent iterations a dummy node may be replaced with a real node.
  • If we have a reference to a dummy node, we should always defer the current target. We shouldn't generate an error, however.
  • Maybe a namespace can be complete even if some names have dummy nodes.
  • Any redefinition or reassignment to a dummy node should not override the dummy node. Looks like we may need to keep track of the statement that defined a dummy node.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions