Skip to content

Instantly share code, notes, and snippets.

@fenollp
Created April 1, 2015 17:48
Show Gist options
  • Select an option

  • Save fenollp/c08e86bdf15b28552824 to your computer and use it in GitHub Desktop.

Select an option

Save fenollp/c08e86bdf15b28552824 to your computer and use it in GitHub Desktop.
Erlang not good with strings
%% -*- coding: utf-8 -*-
-module(wat_clauses).
%% wat_clauses:
%% a warning should be emitted as 2nd clause will never match (given 1st clause)
-export([authenticate_nouns/1]).
%% API
authenticate_nouns([{<<"user_auth">>, _}]) -> 'true';
authenticate_nouns([{<<"user_auth">>, [<<"recovery">>]}]) -> hi;
authenticate_nouns(_Nouns) -> 'false'.
%% End of Module.
@jamesaimonetti

Copy link
Copy Markdown

Probably not the intended order!

@fenollp

fenollp commented Apr 1, 2015

Copy link
Copy Markdown
Author

Yes, wat_clauses:authenticate_nouns([{<<"user_auth">>, [<<"recovery">>]}]) is true instead of hi.

The thing is warnings need to be emitted, either by erlc or dialyzer, and none do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment