Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SemVerRange] 複数条件Rangeの場合にプロパティが正しく設定されない #38

Open
mkht opened this issue Jun 20, 2018 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@mkht
Copy link
Owner

mkht commented Jun 20, 2018

PS> [SemVer]::new('>1.2.0 || 1.0.0')
MinimumVersion : 1.2.0
MaximumVersion : 2147483647.2147483647.2147483647.2147483647
Expression     : >1.2.0 || 1.0.0
IncludeMaximum : True
IncludeMinimum : False

上記例だとExpressionは正しい表記だが、MinimumVersionMaximumVersionが正しくない。
ただしIsSatisfiedを始めとする各種比較系メソッドは正しく動作する

PS> $r = [SemVer]::new('>1.2.0 || 1.0.0')
PS> $r.IsSatisfied('1.0.0')
True
@mkht
Copy link
Owner Author

mkht commented Jun 20, 2018

||を使ったOR複数条件の範囲表現の場合、最も左側にある条件の範囲表現がMinimumVersionMaximumVersionに設定される動作をする。

これは複数条件範囲を単一のMinimumVersionMaximumVersionで表現する適切な方法が無いため、やむを得ずそのような仕様としている。

内部処理的には隠しプロパティである_RangeSetの中にすべての条件を格納して比較処理に使用しているため、比較系メソッドの動作は問題ない。

かなり非直感的な実装なので改善したいが、いい方法が思いつかない 😟

@mkht mkht added bug Something isn't working help wanted Extra attention is needed labels Jun 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant