Disable detection of undefined-function-warnings partially on Elixir < 1.13

This commit is contained in:
Marcel Otto 2022-06-19 22:16:47 +02:00
parent 6109ec66e5
commit c58ffd383b
2 changed files with 18 additions and 10 deletions

View file

@ -26,6 +26,10 @@ jobs:
- pair: - pair:
elixir: 1.12.3 elixir: 1.12.3
otp: 24.3 otp: 24.3
# Although Elixir 1.12 supports this feature, we're expecting errors since the code to suppress
# undefined-function-warnings on RDF.Graph.build blocks relies on Elixir 1.13 and is disabled
# partially on older versions.
no-warnings-as-errors: true
- pair: - pair:
elixir: 1.13.3 elixir: 1.13.3
otp: 23.3 otp: 23.3

View file

@ -276,6 +276,7 @@ defmodule RDF.Graph.Builder do
String.to_atom(short) String.to_atom(short)
end end
if Version.match?(System.version(), ">= 1.13.0") do
defp extract_non_strict_ns(block) do defp extract_non_strict_ns(block) do
modules = modules =
block block
@ -288,6 +289,9 @@ defmodule RDF.Graph.Builder do
for module <- modules, non_strict_vocab_namespace?(module), do: module for module <- modules, non_strict_vocab_namespace?(module), do: module
end end
else
defp extract_non_strict_ns(_), do: []
end
defp non_strict_vocab_namespace?(mod) do defp non_strict_vocab_namespace?(mod) do
Vocabulary.Namespace.vocabulary_namespace?(mod) and not mod.__strict__() Vocabulary.Namespace.vocabulary_namespace?(mod) and not mod.__strict__()