[erlang-questions] Type tuple won't compile

Luis Rascão <>
Tue Dec 30 22:15:51 CET 2014


i'm on 16B03-1, i know about predefined types and if all of them failed i
would have had no problem with this, what bugs me is that only tuple is
raised as an error, guess it's a bug that's since been fixed, thanks!

On Tuesday, December 30, 2014, Mark Nijhof <>
wrote:

> I actually get:
>
> src/t.erl:9: type tuple() already defined
> src/t.erl:12: type list() is a builtin type; it cannot be redefined
> src/t.erl:6: Warning: type map is a new builtin type; its (re)definition
> is allowed only until the next release
>
> Using Erlang 17.3 or 4 (don't seem to be able to get that info after the .
> anymore)
>
>
> On Tue, Dec 30, 2014 at 8:46 PM, Mark Nijhof <
> 
> <javascript:_e(%7B%7D,'cvml','');>> wrote:
>
>> Predefined types:
>> http://www.erlang.org/doc/reference_manual/typespec.html
>>
>> On Tue, Dec 30, 2014 at 5:52 PM, Luis Rascão <
>> <javascript:_e(%7B%7D,'cvml','');>> wrote:
>>
>>> Hi all,
>>> I'm having a hard time figuring out why the following code won't compile:
>>>
>>> -module(t).
>>>
>>> -export([test/1]).
>>>
>>> -record(map, {a, b}).
>>> -type map() :: #map{}.
>>>
>>> -record(tuple, {a, b}).
>>> -type tuple() :: #tuple{}.
>>>
>>> -record(list, {a, b}).
>>> -type list() :: #list{}.
>>>
>>> -spec test(map() | tuple() | list()) -> map | tuple | list.
>>> test(#map{}) -> map;
>>> test(#tuple{}) -> tuple;
>>> test(#list{}) -> list.
>>>
>>> erlc t.erl:
>>>    t.erl:9: type tuple() already defined
>>>
>>> why should the tuple() type throw an error when the others do not?
>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> 
>>> <javascript:_e(%7B%7D,'cvml','');>
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>>
>>
>>
>> --
>> Mark Nijhof
>> t:   @MarkNijhof <https://twitter.com/MarkNijhof>
>> s:  marknijhof
>>
>>
>
>
> --
> Mark Nijhof
> t:   @MarkNijhof <https://twitter.com/MarkNijhof>
> s:  marknijhof
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20141230/989616fc/attachment.html>


More information about the erlang-questions mailing list