Skip to content

Instantly share code, notes, and snippets.

@fenollp

fenollp/wat_clauses

Created Apr 1, 2015
Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@jamesaimonetti jamesaimonetti commented Apr 1, 2015

Probably not the intended order!

@fenollp

This comment has been minimized.

Copy link
Owner Author

@fenollp fenollp commented Apr 1, 2015

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