close
Skip to content

Commit bb4f6c4

Browse files
Update DeclSort::Parameter initializer (#103)
Fix #102
1 parent 9c2971d commit bb4f6c4

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

‎ltx/decls.tex‎

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ \subsection{\valueTag{DeclSort::Parameter}}
277277
\DeclareMember{locus}{SourceLocation} \\
278278
\DeclareMember{type}{TypeIndex} \\
279279
\DeclareMember{constraint}{ExprIndex} \\
280-
\DeclareMember{initializer}{ExprIndex} \\
280+
\DeclareMember{initializer}{DefaultArgIndex} \\
281281
\DeclareMember{level}{ParameterLevel} \\
282282
\DeclareMember{position}{ParameterPosition} \\
283283
\DeclareMember{sort}{ParameterSort} \\
@@ -319,6 +319,36 @@ \subsubsection{Parameter sort}
319319
};
320320
\end{typedef}
321321

322+
\paragraph{The \field{sort} field is redundant.}
323+
Indeed, in a fully and strongly typed representation like the IFC (where every single expression has a type), the
324+
\field{sort} field of a \valueTag{DeclSort::Parameter} structure is redundant because it is a piece of
325+
information that can simply be recovered as follows:
326+
\begin{itemize}
327+
\item A \code{Template} template-parameter (or argument) has a \sortref{Forall}{TypeSort} type.
328+
\item A \code{Type} template-parameter (or argument) has a \sortref{Typename}{TypeBasis} type,
329+
or a refinement thereof.
330+
\item In function and lambda paremeter contexts, only \code{Object} can appear. Otherwise, in template
331+
parameter context, \code{NonType} has a reference or an object type.
332+
\end{itemize}
333+
334+
\subsubsection{Values for default argument}
335+
\label{sec:ifc-parameter-default-initializer}
336+
337+
The value for a possible default argument for a parameter (whether function parameter or a template parameter)
338+
is indicated by an expression (\sortref{NamedDecl}{ExprSort}) that references the declaration for a default
339+
argument (\sortref{DefaultArgument}{DeclSort}). An abstract reference to that specific expression
340+
pattern is of type \type{DefaultArgIndex} defined as
341+
%
342+
\begin{typedef}{DefaultArgIndex}{}
343+
enum class DefaultArgIndex : uint32_t { };
344+
\end{typedef}
345+
%
346+
347+
Valid values of this abstract reference starts at $1$.
348+
The value of that abstract reference (when not null) minus $1$ is an index into the
349+
\sortref{NamedDecl}{ExprSort} partition.\ that references the default argument declaration.
350+
351+
322352
\subsection{\valueTag{DeclSort::Field}}
323353
\label{sec:ifc:DeclSort:Field}
324354

‎ltx/types.tex‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ \subsubsection{Fundamental type basis}
119119
\item \code{TypeBasis::Struct}: fundamental type \code{struct}
120120
\item \code{TypeBasis::Union}: fundamental type \code{union}
121121
\item \code{TypeBasis::Enum}: fundamental type \code{enum}
122-
\item \code{TypeBasis::Typename}: fundamental concept \code{typename}
122+
\item\label{sec:ifc:TypeBasis:Typename} \code{TypeBasis::Typename}: fundamental concept \code{typename}
123123
\item \code{TypeBasis::Namespace}: fundamental type \code{namespace}
124124
\item \code{TypeBasis::Interface}: fundamental type \code{\_\_interface}
125125
\item \code{TypeBasis::Function}: fundamental concept of function. Note: this basis member is object to removal in future revision.

0 commit comments

Comments
 (0)