Skip to content

fix(spdxexp): keep LicenseRef leaves when expanding OR - #166

Closed
MrBeldum wants to merge 1 commit into
github:mainfrom
MrBeldum:fix/expand-or-licenseref
Closed

MrBeldum wants to merge 1 commit into
github:mainfrom
MrBeldum:fix/expand-or-licenseref

Conversation

@MrBeldum

@MrBeldum MrBeldum commented Oct 5, 2026

Copy link
Copy Markdown

Summary

expandOrTerm only kept isLicense() leaves when flattening an OR. A LicenseRef-* alternative was dropped before Satisfies ran, so:

  • Satisfies("MIT OR LicenseRef-x", []string{"LicenseRef-x"}) returned false
  • Satisfies("MIT AND (LicenseRef-a OR LicenseRef-b)", []string{"MIT"}) returned true (the required refs vanished)

expandAndTerm already kept LicenseRef nodes; this mirrors that in expandOrTerm.

Fixes #165.

Test plan

expandOrTerm only appended isLicense() terms, so a LicenseRef
alternative of OR was dropped before Satisfies ran. expandAndTerm
already kept LicenseRef nodes; mirror that in expandOrTerm.

Fixes github#165.
@elrayle

elrayle commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

@MrBeldum Thanks for the proposed fix. To be consistent with existing tests, I added tests to satisfies_test.go under PR #167. Since your proposed fix is just what was needed, I added you as a co-author to that PR.

Closing this PR as superseded by #167.

@elrayle elrayle closed this Oct 5, 2026
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.

Satisfies ignores a LicenseRef alternative of an OR

2 participants