[erlang-questions] Change in abstract format of user-specified -types in 18.0 (breaks PropEr)

Garret Smith garret.smith@REDACTED
Tue Jul 7 02:25:17 CEST 2015


This code:
-module(tt).

-type a() :: atom().
-type b() :: a().

has a different abstract syntax in 18.0 vs 17.5 as returned by
epp:parse_file("tt.erl", [])

in 18.0:
{ok,[{attribute,1,file,{"tt.erl",1}},
     {attribute,1,module,tt},
     {attribute,3,type,{a,{type,3,atom,[]},[]}},
     {attribute,4,type,{b,{user_type,4,a,[]},[]}},          <-- user_type
     {eof,6}]}

and in 17.0:
{ok,[{attribute,1,file,{"tt.erl",1}},
     {attribute,1,module,tt},
     {attribute,3,type,{a,{type,3,atom,[]},[]}},
     {attribute,4,type,{b,{type,4,a,[]},[]}},                   <-- type
     {eof,6}]}

When I use PropEr on a module containing module-defined types like 'b'
above, it fails with: Error: The typeserver encountered an error:
{unsupported_type,{user_type,45,point,[]}}.

The module I'm checking defines -type point() and uses it in other types.

Question: is this a bug, since 17.x included user_type in the abstract
format, but apparently never actually used it?

If this was an intended fix, I didn't read about it in the release
notes (only about improving the documentation of the abstract format).
Any other code, including parse transforms, that work with the
abstract format could be affected as well.

Thanks,
Garret



More information about the erlang-questions mailing list