Skip to content

Small correctness and test-coverage gaps from the L3 reviews #28

Open

Description

@sinha108

Small, independent items found by the reviews of PR #16. None hides a known high-impact bug. Pick off one at a time and tick it here.

Correctness

  • type I2 I1 (a defined type over an interface) gets kind: interface but no methods or base types. Populate its method set from the underlying interface.

  • Panic detection misses a method value taken through a struct that embeds an interface (s.M, where s embeds a nil interface). No exception edge is added.

  • Unresolved receiver types. A method value on a receiver whose type failed to type-check is recorded as a field path (req.Set) in ddg var. Record it as a method use. This one is cosmetic.

  • Builtin-scope types. Calls on them, such as err.Error(), get a junk internal callee signature (.error.Error). The emitted callee is correctly null. Record no signature.

  • Symlinked project directories. Library detection compares paths with filepath.Abs but not EvalSymlinks, so a symlinked project directory can misclassify files. Resolve symlinks before comparing.

  • Spans in malformed functions. In a function with severe syntax errors, L3 body-node spans can be inverted or point into another file (e.g. bytes [113,0]). There is no crash. BuildNodes takes End positions from fset.Position without checking they are in the node's file (internal/dataflow/bodynodes.go). Clamp End to Pos's file.

  • Reassigning a slice from append kills its element defs. In s[0] = 5; s = append(s, n); return s[0], the strong def of s kills the earlier s[*] def, although append may return the same backing array. Treat s = append(s, …) as a weak def of s[*].

Test coverage

  • Superset check. TestGateL2_SupersetOfL1 builds its L2 input without external_symbols, so it skips the library-edge path.
  • Satellite call nodes. Their parent assignment is untested for calls in folded for init/post, case lists, select comm clauses and range expressions. Do this before L4: port wiring depends on it.
  • Range forms. Add a Go 1.23+ fixture module with exact-edge CFG tests for range over an integer and over an iterator function. testdata/dataflow declares go 1.21.

Consolidates #24 and #25.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions