Remove elixir 1 9 deprecations #23
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With elixir v1.9 there are warnings when updating structs using the struct name. e.g.
vs
This change is backward compatible with old elixir versions.
After
Before
$ mix compile --force Compiling 20 files (.ex) warning: a struct for Samly.Assertion is expected on struct update: %Samly.Assertion{assertion | idp_id: idp_id} but got type: dynamic() where "assertion" was given the type: # type: dynamic() # from: lib/samly/sp_handler.ex:37:27 {:ok, assertion} <- Samly.Helper.decode_idp_auth_resp(sp, saml_encoding, saml_response) when defining the variable "assertion", you must also pattern match on "%Samly.Assertion{}". hint: given pattern matching is enough to catch typing errors, you may optionally convert the struct update into a map update. For example, instead of: user = some_function() %User{user | name: "John Doe"} it is enough to write: %User{} = user = some_function() %{user | name: "John Doe"} typing violation found at: │ 39 │ assertion = %Assertion{assertion | idp_id: idp_id}, │ ~ │ └─ lib/samly/sp_handler.ex:39:22: Samly.SPHandler.consume_signin_response/1 warning: a struct for Samly.IdpData is expected on struct update: %Samly.IdpData{idp_data | id: id, sp_id: sp_id, base_url: Map.get(opts_map, :base_url)} but got type: dynamic() where "idp_data" was given the type: # type: dynamic() # from: lib/samly/idp_data.ex:113:24 idp_data when defining the variable "idp_data", you must also pattern match on "%Samly.IdpData{}". hint: given pattern matching is enough to catch typing errors, you may optionally convert the struct update into a map update. For example, instead of: user = some_function() %User{user | name: "John Doe"} it is enough to write: %User{} = user = some_function() %{user | name: "John Doe"} typing violation found at: │ 115 │ %IdpData{idp_data | id: id, sp_id: sp_id, base_url: Map.get(opts_map, :base_url)} │ ~ │ └─ lib/samly/idp_data.ex:115:5: Samly.IdpData.save_idp_config/2 warning: a struct for Samly.IdpData is expected on struct update: %Samly.IdpData{idp_data | esaml_idp_rec: to_esaml_idp_metadata(idp_data, opts_map)} but got type: dynamic() where "idp_data" was given the type: # type: dynamic() # from: lib/samly/idp_data.ex:156:26 idp_data when defining the variable "idp_data", you must also pattern match on "%Samly.IdpData{}". hint: given pattern matching is enough to catch typing errors, you may optionally convert the struct update into a map update. For example, instead of: user = some_function() %User{user | name: "John Doe"} it is enough to write: %User{} = user = some_function() %{user | name: "John Doe"} typing violation found at: │ 159 │ idp_data = %IdpData{idp_data | esaml_idp_rec: to_esaml_idp_metadata(idp_data, opts_map)} │ ~ │ └─ lib/samly/idp_data.ex:159:20: Samly.IdpData.update_esaml_recs/3 warning: a struct for Samly.IdpData is expected on struct update: %Samly.IdpData{ idp_data | entity_id: get_entity_id(md_xml), signed_requests: get_req_signed(md_xml), certs: signing_certs, fingerprints: idp_cert_fingerprints(signing_certs), sso_redirect_url: get_sso_redirect_url(md_xml), sso_post_url: get_sso_post_url(md_xml), slo_redirect_url: get_slo_redirect_url(md_xml), slo_post_url: get_slo_post_url(md_xml), nameid_format: get_nameid_format(md_xml) } but got type: dynamic() where "idp_data" was given the type: # type: dynamic() # from: lib/samly/idp_data.ex:263:31 idp_data when defining the variable "idp_data", you must also pattern match on "%Samly.IdpData{}". hint: given pattern matching is enough to catch typing errors, you may optionally convert the struct update into a map update. For example, instead of: user = some_function() %User{user | name: "John Doe"} it is enough to write: %User{} = user = some_function() %{user | name: "John Doe"} typing violation found at: │ 274 │ %IdpData{ │ ~ │ └─ lib/samly/idp_data.ex:274:5: Samly.IdpData.from_xml/2 Generated samly app