Skip to content

Example in Version ordering doc does not match implementation - #9

Merged
alexarchambault merged 4 commits into
coursier:mainfrom
fthomas:topic/failing-examples-from-doc
Sep 4, 2026
Merged

Example in Version ordering doc does not match implementation#9
alexarchambault merged 4 commits into
coursier:mainfrom
fthomas:topic/failing-examples-from-doc

Conversation

@fthomas

@fthomas fthomas commented Sep 16, 2020

Copy link
Copy Markdown
Contributor

The documentation for Version ordering contains this example:

1.0.1 or 1.0.1.0 goes before 1.0.1e (literal e goes after empty / zero items)

But this does not match the implementation which is demonstrated by the
added test:

utest.AssertionError: assert(compare("1.0.1", "1.0.1e" ) < 0)

1.0.1 and 1.0.1.0 are both actually greater than 1.0.1e:

scala> Version("1.0.1").compare(Version("1.0.1e"))
val res1: Int = 1

scala> Version("1.0.1.0").compare(Version("1.0.1e"))
val res2: Int = 1

@alexarchambault

Copy link
Copy Markdown
Member

Thanks for the report! That needs to be investigated…

The [documentation for Version ordering](https://get-coursier.io/docs/other-version-handling.html#ordering)
contains this example:

> 1.0.1 or 1.0.1.0 goes before 1.0.1e (literal e goes after empty / zero items)

But this does not match the implementation which is demonstrated by the
added test:
```
utest.AssertionError: assert(compare("1.0.1", "1.0.1e" ) < 0)
```

1.0.1 and 1.0.1.0 are both actually greater than 1.0.1e:
```scala
scala> Version("1.0.1").compare(Version("1.0.1e"))
val res1: Int = 1

scala> Version("1.0.1.0").compare(Version("1.0.1e"))
val res2: Int = 1
```
@alexarchambault
alexarchambault force-pushed the topic/failing-examples-from-doc branch from 84af9d6 to 3ef0079 Compare September 4, 2026 00:03
alexarchambault and others added 3 commits September 4, 2026 02:04
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
@alexarchambault
alexarchambault force-pushed the topic/failing-examples-from-doc branch from 3ef0079 to d0dd52c Compare September 4, 2026 00:04
@alexarchambault
alexarchambault marked this pull request as ready for review September 4, 2026 00:09
@alexarchambault

Copy link
Copy Markdown
Member

This also contains slight departure from the current doc. coursier/coursier#3813 updates the documentation accordingly.

@alexarchambault
alexarchambault merged commit a0c18a2 into coursier:main Sep 4, 2026
4 checks passed
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