Skip to content

fix: error call in with_vertex_()/with_edge_() should report make_(), not internal helper#2609

Merged
krlmlr merged 4 commits intomainfrom
copilot/fix-make-function-error
Apr 9, 2026
Merged

fix: error call in with_vertex_()/with_edge_() should report make_(), not internal helper#2609
krlmlr merged 4 commits intomainfrom
copilot/fix-make-function-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 9, 2026

When with_vertex_() or with_edge_() passed an invalid-length attribute value inside make_(), the error message showed an internal helper function rather than the user-facing make_().

Changes Made

  • R/make.R: Pass rlang::current_env() (not sys.call()) from make_() to .apply_modifiers(). Use internal i_set_vertex_attr()/i_set_edge_attr() directly in .apply_modifiers() so the call environment can be forwarded without touching exported function signatures.
  • R/attributes.R: Fix cli_abort(.call = ...)cli_abort(call = ...) (.call is not a parameter of cli_abort). In set_vertex_attr(), set_vertex_attrs(), and set_edge_attr(), capture rlang::current_env() as a local variable rather than adding a call parameter to the exported signatures.

Testing

  • ✅ All 99 attribute tests pass
  • make_(…, with_vertex_(color = 1:2))Error in 'make_()':
  • make_(…, with_edge_(color = 1:2))Error in 'make_()':
  • set_vertex_attr(g, …)Error in 'set_vertex_attr()':
  • set_edge_attr(g, …)Error in 'set_edge_attr()':

GitHub Copilot was used to prepare this PR.

  • By submitting this pull request, I assign the copyright of my contribution to The igraph development team.

Copilot AI and others added 2 commits April 9, 2026 11:03
@krlmlr
Copy link
Copy Markdown
Contributor

krlmlr commented Apr 9, 2026

@copilot: Keep the signature of expored functions unchanged.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 9, 2026

@copilot: Keep the signature of expored functions unchanged.

Fixed in 9f300a8. The call parameter has been removed from the signatures of set_vertex_attr(), set_vertex_attrs(), and set_edge_attr(). Each function now captures rlang::current_env() as a local variable and forwards it to the internal helpers. .apply_modifiers() also now calls i_set_vertex_attr()/i_set_edge_attr() directly instead of the exported wrappers.

@krlmlr krlmlr marked this pull request as ready for review April 9, 2026 14:11
@krlmlr krlmlr merged commit 6ee0ee7 into main Apr 9, 2026
@krlmlr krlmlr deleted the copilot/fix-make-function-error branch April 9, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants