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

Fix warnings for Elixir 1.16 and update Elixir version requirement #58

Merged
merged 3 commits into from
Apr 23, 2024
Merged

Fix warnings for Elixir 1.16 and update Elixir version requirement #58

merged 3 commits into from
Apr 23, 2024

Conversation

wkirschbaum
Copy link
Contributor

No description provided.

assert doc(:person, %{occupation: "Developer", city: "Montreal"}) ==
~s|<?xml version="1.0" encoding="UTF-8"?>\n<person city="Montreal" occupation="Developer"/>|
assert doc(:person, %{occupation: "Developer", city: "Montreal"}) in [
~s|<?xml version="1.0" encoding="UTF-8"?>\n<person city="Montreal" occupation="Developer"/>|,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order of these attributes changes between Elixir v1.14 and v1.15, but don't believe it has a significant impact.

otp: ['22.3']
elixir: ['1.11.2', '1.10.4', '1.9.4', '1.8.2', '1.7.4', '1.6.6']
otp: [24.x, 25.x, 26.x]
elixir: [1.12.x, 1.13.x, 1.14.x, 1.15.x, 1.16.x]
Copy link
Owner

@joshnuss joshnuss Apr 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to stop testing OTP 22.x, Elixir 1.6 - 1.11?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is any harm to include older version if it does not impede future supported versions. Elixir 1.11 is not "supported" anymore: https://hexdocs.pm/elixir/1.16.2/compatibility-and-deprecations.html

Since upgrading Elixir should be very simple, it should be acceptable for new libraries releases to only support from 1.12.x.

I will add Elixir 1.11 to see if it passes the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding 1.11 gives the following compilation errors:

== Compilation error in file lib/nimble_parsec/compiler.ex ==
Error: ** (CompileError) lib/nimble_parsec/compiler.ex:931: cannot find or invoke local _/1 inside match. Only macros can be invoked in a match and they must be defined before their invocation. Called as: _(/ / _ = range)
could not compile dependency :nimble_parsec, "mix compile" failed. You can recompile this dependency with "mix deps.compile nimble_parsec", update it with "mix deps.update nimble_parsec" or clean it with "mix deps.clean nimble_parsec"
    (stdlib 3.17.2.4) lists.erl:1358: :lists.mapfoldl/3
    (stdlib 3.17.2.4) lists.erl:1359: :lists.mapfoldl/3
    (stdlib 3.17.2.4) lists.erl:1358: :lists.mapfoldl/3
    (stdlib 3.17.2.4) lists.erl:1359: :lists.mapfoldl/3
    (elixir 1.11.4) expanding macro: Kernel.".."/2
    lib/nimble_parsec/compiler.ex:931: NimbleParsec.Compiler.newline_allowed?/1

so think it is better to set the minimum to elixir 1.12. wdyt?

@joshnuss
Copy link
Owner

Thanks @wkirschbaum!

Looks good, I left a small comment, but otherwise good to go.

Do you know why order of attributes in Map changed in newer version of Elixir?

@wkirschbaum
Copy link
Contributor Author

@joshnuss I am not entirely sure, but according to the Map documentation: Key-value pairs in a map do not follow any order (that's why the printed map in the example above has a different order than the map that was created).

So either it has to be manually ordered after retrieval or we need to accept ordering won't be predictable.

Regarding, the 1.12 constraint on Elixir: it is because of a failure of the latest version of the nimble_parsec library, but also because Elixir 1.11 is not "supported" anymore, so probably not worth supporting it in this library anymore.

@joshnuss
Copy link
Owner

Thanks @wkirschbaum

OK, sounds good, let's set 1.12 as the minimum.

So either it has to be manually ordered after retrieval or we need to accept ordering won't be predictable.

My only concern is that downstream, people will have unit tests making the same assumption, and they will break. But the alternative is sorting, which will hurt perf

@wkirschbaum
Copy link
Contributor Author

Its already a problem. Nothing in the PR changes the behaviour, we are just testing more versions to expose these kinds of issues.

@joshnuss joshnuss merged commit e05a22d into joshnuss:master Apr 23, 2024
24 checks passed
@joshnuss
Copy link
Owner

Thanks @wkirschbaum!!

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