Skip to main content

L1343 - Native Record Index

Error

-module(main).
-export([f/0]).
-record(#point {x, y}).
f() -> #point.x.
%% ^^^^^^^^ error: syntax #point.x is only supported for tuple records

Explanation

The error occurs when the record index syntax #Record.Field is used with a native record (EEP-79).

The #Record.Field expression evaluates to the position of a field in the underlying tuple, which is only meaningful for tuple records. Native records do not have a stable tuple layout, so the syntax is not supported for them. To fix the error, use field access (Expr#Record.Field) on a record value instead.