Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
visitors
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
POTTIER Francois
visitors
Commits
c54b05dd
Commit
c54b05dd
authored
8 years ago
by
POTTIER Francois
Browse files
Options
Downloads
Patches
Plain Diff
New auxiliary function [datacon_opacity_warning].
parent
ad63b042
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Visitors.ml
+15
-13
15 additions, 13 deletions
src/Visitors.ml
with
15 additions
and
13 deletions
src/Visitors.ml
+
15
−
13
View file @
c54b05dd
...
...
@@ -53,6 +53,20 @@ let generate_virtual_method m ty =
include
WarningStore
(
struct
end
)
(* [datacon_opacity_warning cd] emits a technical warning (if necessary). One
should not write "A of int[@opaque]". Instead, one should write "A of
(int[@opaque])". In the case of records fields, we fix this silently, by
moving the attribute from the record field to the type, but in the case of
data constructors with multiple fields, it is preferable to be strict. *)
let
datacon_opacity_warning
(
cd
:
constructor_declaration
)
:
unit
=
if
opacity
cd
.
pcd_attributes
=
Opaque
then
warning
cd
.
pcd_loc
(
sprintf
"%s: @opaque, attached to a data constructor, is ignored.
\n
\
It should be attached to a type. Please use parentheses."
plugin
)
(* -------------------------------------------------------------------------- *)
(* We support parameterized type declarations. We require them to be regular.
...
...
@@ -798,19 +812,7 @@ and visit_types tys (ess : expressions list) : expressions =
and definitions. *)
let
constructor_declaration
decl
(
cd
:
constructor_declaration
)
:
case
=
(* A technical warning. One should not write "A of int[@opaque]".
Instead, one should write "A of (int[@opaque])".
In the case of records fields, we fix this silently, but in
the case of data constructors with multiple fields, it is
preferable to be strict. *)
if
opacity
cd
.
pcd_attributes
=
Opaque
then
warning
cd
.
pcd_loc
(
sprintf
"%s: @opaque, attached to a data constructor, is ignored.
\n
\
It should be attached to a type. Please use parentheses."
plugin
);
datacon_opacity_warning
cd
;
(* This is either a traditional data constructor, whose components are
anonymous, or a data constructor whose components form an ``inline
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment