Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions conformance/sv-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,23 @@ from successful runs still reach the official assertion evaluator. The official
runner timeout covers the complete invocation, including all variants.
Elaboration/parsing cases do not execute variants.

Parameterized classes update fourteen more rows: both state modes for
`8.5--parameters`, `8.8--typed_constructor_param`,
`8.25--parametrized_class_extend`, `8.25.1--parametrized_class_scope_resolution`
and `8.26.3--type_access_implements` change from fail to pass. Each was
simulated and its displayed values checked, including the parameter that
`par_cls#()::b` reads and the base constructor argument passed by name in
`8.8--typed_constructor_param`. The negative
`8.26.6.2--parameter_type_conflict_unresolved` and
`8.26.6.3--diamond_relationship_parametrized` probes now fail for the reason
they test: an interface class inherits `T` from two different interface
classes or specializations without declaring its own. Full official runs at the
pinned revision report 1080 passing cases in 2state and 1091 in 4state, with no
passing case regressing; `8.25.1--parametrized_class_invalid_scope_resolution`
stays a passing negative case because `par_cls::b` outside the class is
rejected. `8.5--properties_enum` keeps failing because enumeration constants
declared in a class are not supported.

## Running locally

Use the locked development shell and install the pinned [`requirements.txt`](requirements.txt) in a Python environment.
Expand Down
28 changes: 14 additions & 14 deletions conformance/sv-tests/expected.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -1503,12 +1503,12 @@ chapter-8/8.23--scope_resolution.sv 2state pass
chapter-8/8.23--scope_resolution.sv 4state pass
chapter-8/8.24--out_of_block_methods.sv 2state pass
chapter-8/8.24--out_of_block_methods.sv 4state pass
chapter-8/8.25--parametrized_class_extend.sv 2state fail
chapter-8/8.25--parametrized_class_extend.sv 4state fail
chapter-8/8.25--parametrized_class_extend.sv 2state pass
chapter-8/8.25--parametrized_class_extend.sv 4state pass
chapter-8/8.25.1--parametrized_class_invalid_scope_resolution.sv 2state pass
chapter-8/8.25.1--parametrized_class_invalid_scope_resolution.sv 4state pass
chapter-8/8.25.1--parametrized_class_scope_resolution.sv 2state fail
chapter-8/8.25.1--parametrized_class_scope_resolution.sv 4state fail
chapter-8/8.25.1--parametrized_class_scope_resolution.sv 2state pass
chapter-8/8.25.1--parametrized_class_scope_resolution.sv 4state pass
chapter-8/8.26.2--implements.sv 2state pass
chapter-8/8.26.2--implements.sv 4state pass
chapter-8/8.26.2--implements_extends.sv 2state pass
Expand All @@ -1517,8 +1517,8 @@ chapter-8/8.26.2--implements_multiple.sv 2state pass
chapter-8/8.26.2--implements_multiple.sv 4state pass
chapter-8/8.26.3--type_access_extends.sv 2state pass
chapter-8/8.26.3--type_access_extends.sv 4state pass
chapter-8/8.26.3--type_access_implements.sv 2state fail
chapter-8/8.26.3--type_access_implements.sv 4state fail
chapter-8/8.26.3--type_access_implements.sv 2state pass
chapter-8/8.26.3--type_access_implements.sv 4state pass
chapter-8/8.26.3--type_access_implements_invalid.sv 2state pass
chapter-8/8.26.3--type_access_implements_invalid.sv 4state pass
chapter-8/8.26.4--illegal_forward_def_implements.sv 2state pass
Expand All @@ -1537,20 +1537,20 @@ chapter-8/8.26.6.1--name_conflict_unresolved.sv 2state pass
chapter-8/8.26.6.1--name_conflict_unresolved.sv 4state pass
chapter-8/8.26.6.2--parameter_type_conflict.sv 2state pass
chapter-8/8.26.6.2--parameter_type_conflict.sv 4state pass
chapter-8/8.26.6.2--parameter_type_conflict_unresolved.sv 2state fail
chapter-8/8.26.6.2--parameter_type_conflict_unresolved.sv 4state fail
chapter-8/8.26.6.2--parameter_type_conflict_unresolved.sv 2state pass
chapter-8/8.26.6.2--parameter_type_conflict_unresolved.sv 4state pass
chapter-8/8.26.6.3--diamond_relationship.sv 2state pass
chapter-8/8.26.6.3--diamond_relationship.sv 4state pass
chapter-8/8.26.6.3--diamond_relationship_parametrized.sv 2state fail
chapter-8/8.26.6.3--diamond_relationship_parametrized.sv 4state fail
chapter-8/8.26.6.3--diamond_relationship_parametrized.sv 2state pass
chapter-8/8.26.6.3--diamond_relationship_parametrized.sv 4state pass
chapter-8/8.26.7--partial_implementation.sv 2state pass
chapter-8/8.26.7--partial_implementation.sv 4state pass
chapter-8/8.27--forward_declaration.sv 2state pass
chapter-8/8.27--forward_declaration.sv 4state pass
chapter-8/8.4--instantiation.sv 2state pass
chapter-8/8.4--instantiation.sv 4state pass
chapter-8/8.5--parameters.sv 2state fail
chapter-8/8.5--parameters.sv 4state fail
chapter-8/8.5--parameters.sv 2state pass
chapter-8/8.5--parameters.sv 4state pass
chapter-8/8.5--properties.sv 2state pass
chapter-8/8.5--properties.sv 4state pass
chapter-8/8.5--properties_enum.sv 2state fail
Expand All @@ -1565,8 +1565,8 @@ chapter-8/8.7--constructor_super.sv 2state pass
chapter-8/8.7--constructor_super.sv 4state pass
chapter-8/8.8--typed_constructor.sv 2state pass
chapter-8/8.8--typed_constructor.sv 4state pass
chapter-8/8.8--typed_constructor_param.sv 2state fail
chapter-8/8.8--typed_constructor_param.sv 4state fail
chapter-8/8.8--typed_constructor_param.sv 2state pass
chapter-8/8.8--typed_constructor_param.sv 4state pass
chapter-8/8.9--static_properties.sv 2state pass
chapter-8/8.9--static_properties.sv 4state pass
chapter-9/9.2.1--initial.sv 2state pass
Expand Down
30 changes: 30 additions & 0 deletions crates/celox-sv-analyzer/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@ pub(super) struct AnalysisState {
generate_items: generate::Memo,
/// Classes laid out so far, by name.
classes: std::cell::RefCell<HashMap<String, std::rc::Rc<classes::Class>>>,
/// The constants and types of the scope that declares each class, which
/// its parameter defaults and body see (IEEE 1800-2023 8.25).
class_declaration_scopes:
std::cell::RefCell<HashMap<String, (HashMap<String, i128>, HashMap<String, Type>)>>,
/// Set once the class methods of the scope being analyzed have their
/// signatures, after which a new specialization would have none.
class_specializations_frozen: std::cell::Cell<bool>,
/// The class specializations being made, which their own declarations
/// may name before they are complete.
class_specializations_building: std::cell::RefCell<Vec<String>>,
/// How many class specializations are being made, one inside another.
class_specialization_depth: std::cell::Cell<usize>,
/// The specializations of classes made so far, in order.
class_specializations: std::cell::RefCell<
Vec<(
String,
std::rc::Rc<classes::specializations::Specialization>,
)>,
>,
}

/// Syntax and specialization bindings for one scope within an analysis session.
Expand Down Expand Up @@ -666,6 +685,9 @@ impl Module {
export_symbols: bool,
header_ports: Option<&port_owners::Selection<'_>>,
) -> Result<Self, AnalyzerError> {
// The scope makes its class specializations until its class methods
// have signatures.
syntax_tree.state.class_specializations_frozen.set(false);
let unit = syntax_tree.scope_handle().unit(syntax_tree.declarations());
let is_package = unit.is_none_or(|unit| unit.kind == celox_sv_syntax::UnitKind::Package);
let program = unit.is_some_and(|unit| unit.kind == celox_sv_syntax::UnitKind::Program);
Expand Down Expand Up @@ -772,6 +794,8 @@ impl Module {
.iter()
.map(|parameter| parameter.name().to_string())
.collect();
// Class parameter defaults are bound where the class is declared.
classes::specializations::declare_scopes(syntax_tree, &const_env, &type_aliases);
let declaration_subroutines =
with_imported(const_functions::symbolic_module_constant_functions(
syntax_tree,
Expand Down Expand Up @@ -903,6 +927,12 @@ impl Module {
{
return Err(AnalyzerError::Unsupported("ref port direction".to_string()));
}
// The static properties of each class specialization are variables
// of the module (IEEE 1800-2023 8.9, 8.25).
classes::specializations::collect(
syntax_tree,
&PackedDimensions::new(HashMap::default(), &const_env, &type_aliases),
);
let mut signals = signals_from_scope(syntax_tree, &const_env, &type_aliases)?;
signals.extend(
array_parameters
Expand Down
Loading
Loading