Repository navigation
Description
Originally from module.cpp (RIP)
-
Persistent
set_option. We want to be able to store the option settings in .olean files.
The main issue is conflict between imported modules. That is, each imported module wants to
set a particular option with a different value. This can create counter-intuitive behavior.
Consider the following scenarioA.olean: sets optionfooto trueB.olean: imports A.oleanC.olean: sets optionfooto false- We create
D.leancontaining the following import clause:The user may expect thatimport B C Afoois set to true sinceAis the last module to be imported,
but this is not the case.Bis imported first, thenA(which sets optionfooto true),
thenC(which sets optionfooto false), the last importAis skipped sinceAhas already
been imported, and we getfooset to false.
To address this issue we consider a persistent option import validator. The validator
signs an error if there are two direct imports which try to set the same option to different
values. For example, in the example above,BandCare conflicting, and an error would
be signed when trying to importC. Then, users would have to resolve the conflict by
creating an auxiliary import. For example, they could create the moduleC_aux.leancontainingimport C set_option persistent foo trueand replace
import B C Awithimport B C_aux A -
Removing attributes. The validation procedure for persistent options can be extended to attribute deletion. In the latest version, we can only locally remove attributes. The validator for attribute deletion would sign an error if there are two direct imports where one adds an attribute
[foo]to a declarationblaand the other removes it. -
Parametric attributes. This is not a missing feature, but a bug. In the current version, we have
parametric attributes and different modules may set the same declaration with different parameter values.
We can fix this bug by using an attribute validator which will check parametric attributes, or we can allow parametric attributes to be set only once. That is, we sign an error if the user tries to reset them.
Activity
chore: disable #4006
chore: disable #4006 (#4021)