How to define linear abstract types based on records

Skip to first unread message


Dec 10, 2021, 8:58:16 PM12/10/21
to ats-lang-users
So, I've got the following defined in my ".sats" file:
absvt@ype mesh = @{v=int, t=int}

In my ".dats" file, I've defined the following:
assume mesh =
[v,t:nat | v == t*3]
  v=int v, t=int t
implement mesh_new (  ) = let
    v=3, t=1

  Where "mesh_new()" is simply a function that returns a new "mesh" value.  The code I'm showing is a simplified version of my code that still exhibits the issue I was encountering (my original version had arrays, hence it being linear.)
  I've been getting the following cryptic error message when compiling my code:
!patscc -c g_engine.dats
g_engine_dats.c:47259:1: error: conflicting types for ‘str_043__045_’; have ‘postiats_tyrec_15()’
47259 | str_043__045_()
      | ^~~~~~~~~~~~~
g_engine_dats.c:25134:1: note: previous definition of ‘str_043__045_’ with type ‘postiats_tyrec_7(atstype_float,  atstype_float,  atstype_float,  atstype_float,  atstype_float,  atstype_float,  atstype_float,  atstype_float,  atstype_float,  atstype_float,  atstype_float,  atstype_float,  atstype_float,  atstype_float,  atstype_float,  atstype_float)’ {aka ‘postiats_tyrec_7(float,  float,  float,  float,  float,  float,  float,  float,  float,  float,  float,  float,  float,  float,  float,  float)’}
25134 | str_043__045_(atstkind_t0ype(atstype_float) arg0, atstkind_t0ype(atstype_float) arg1, atstkind_t0ype(atstype_float) arg2, atstkind_t0ype(atstype_float) arg3, atstkind_t0ype(atstype_float) arg4, atstkind_t0ype(atstype_float) arg5, atstkind_t0ype(atstype_float) arg6, atstkind_t0ype(atstype_float) arg7, atstkind_t0ype(atstype_float) arg8, atstkind_t0ype(atstype_float) arg9, atstkind_t0ype(atstype_float) arg10, atstkind_t0ype(atstype_float) arg11, atstkind_t0ype(atstype_float) arg12, atstkind_t0ype(atstype_float) arg13, atstkind_t0ype(atstype_float) arg14, atstkind_t0ype(atstype_float) arg15)
      | ^~~~~~~~~~~~~
My question is, what am I doing wrong?  Additionally, if you have any suggestions for where to look for an answer, that would also be welcomed.  Also, feel free to request more details, since this is a simplified version of my code and I may have accidentally omitted an important detail.  I appreciate any and all help that can be provided.

Hongwei Xi

Dec 10, 2021, 9:15:48 PM12/10/21
I could not produce the error by using the code snippet you provided.

The error message in your code is likely due to the conflict between nominal type equality
(in C) and structural type equality (in ATS); postiats_tyrec_7 and postiats_tyrec_15 are nominally
different in C but they should be based on two types in ATS that are structurally equal.

I may be able to suggest something if I could produce the error on my side.


You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit


Dec 10, 2021, 9:40:32 PM12/10/21
to ats-lang-users
Took a closer look at my code, and turns out there was a stray "= "sta%"" after the "mesh_new()" function that I'd missed.  Thanks for looking at this, I was super confused. :)
Reply all
Reply to author
0 new messages