Skip to content

Commit c0b7803

Browse files
authored
Added built-in breaking versions to language breaking versions (#1480)
We now consider built-in changes as language breaking changes.
1 parent 962ca4d commit c0b7803

File tree

41 files changed

+794
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+794
-10
lines changed

crates/codegen/generator/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl RuntimeModel {
6868
slang_version: CargoWorkspace::local_version()?,
6969
language_name: language.name.to_string(),
7070
all_language_versions: language.versions.iter().cloned().collect(),
71-
breaking_language_versions: language.collect_breaking_versions(),
71+
breaking_language_versions: language.collect_grammar_breaking_versions(),
7272

7373
ast: AstModel::from_language(language),
7474
bindings: BindingsModel::from_language(language)?,

crates/codegen/spec/src/generators/supported_versions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn generate_supported_versions(model: &SpecModel) -> Result<String> {
2727

2828
let breaking_versions = model
2929
.language
30-
.collect_breaking_versions()
30+
.collect_all_breaking_versions()
3131
.iter()
3232
.map(|version| format!("`{version}`"))
3333
.collect_vec();

crates/codegen/testing/src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub(crate) fn generate_unit_test_file(
101101
pub(crate) fn generate_version_breaks(language: &Language, output_dir: &Path) -> Result<()> {
102102
let mut fs = CodegenFileSystem::default();
103103

104-
let versions = language.collect_breaking_versions();
104+
let versions = language.collect_all_breaking_versions();
105105
let versions_len = versions.len();
106106

107107
let mut contents = String::new();

crates/language-v2/definition/src/model/manifest.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,20 @@ impl Language {
3838
self.topics().flat_map(|topic| &topic.items)
3939
}
4040

41-
/// Collects all versions that change the language grammar in a breaking way.
41+
/// Collects all versions that change the language in a breaking way.
4242
///
4343
/// Includes the first supported version.
44-
pub fn collect_breaking_versions(&self) -> BTreeSet<Version> {
44+
pub fn collect_all_breaking_versions(&self) -> BTreeSet<Version> {
45+
let mut ans = self.collect_grammar_breaking_versions();
46+
ans.append(&mut self.collect_built_ins_versions());
47+
48+
ans
49+
}
50+
51+
/// Collects all versions that change the language grammar in a breaking way.
52+
///
53+
/// Note: this does not include built-ins related breaks, consider using `collect_all_breaking_versions` instead.
54+
pub fn collect_grammar_breaking_versions(&self) -> BTreeSet<Version> {
4555
let first = self.versions.first().unwrap().clone();
4656
let mut res = BTreeSet::from_iter([first]);
4757

@@ -108,6 +118,8 @@ impl Language {
108118
///
109119
/// Includes the first supported version. Returns an empty set if there are
110120
/// no built-ins defined.
121+
///
122+
/// Note: this does not include grammar related breaks, consider using `collect_all_breaking_versions` instead.
111123
pub fn collect_built_ins_versions(&self) -> BTreeSet<Version> {
112124
if self.built_ins.is_empty() {
113125
return BTreeSet::new();

crates/language/definition/src/model/manifest.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,20 @@ impl Language {
3838
self.topics().flat_map(|topic| &topic.items)
3939
}
4040

41-
/// Collects all versions that change the language grammar in a breaking way.
41+
/// Collects all versions that change the language in a breaking way.
4242
///
4343
/// Includes the first supported version.
44-
pub fn collect_breaking_versions(&self) -> BTreeSet<Version> {
44+
pub fn collect_all_breaking_versions(&self) -> BTreeSet<Version> {
45+
let mut ans = self.collect_grammar_breaking_versions();
46+
ans.append(&mut self.collect_built_ins_versions());
47+
48+
ans
49+
}
50+
51+
/// Collects all versions that change the language grammar in a breaking way.
52+
///
53+
/// Note: this does not include built-ins related breaks, consider using `collect_all_breaking_versions` instead.
54+
pub fn collect_grammar_breaking_versions(&self) -> BTreeSet<Version> {
4555
let first = self.versions.first().unwrap().clone();
4656
let mut res = BTreeSet::from_iter([first]);
4757

@@ -110,6 +120,8 @@ impl Language {
110120
///
111121
/// Includes the first supported version. Returns an empty set if there are
112122
/// no built-ins defined.
123+
///
124+
/// Note: this does not include grammar related breaks, consider using `collect_all_breaking_versions` instead.
113125
pub fn collect_built_ins_versions(&self) -> BTreeSet<Version> {
114126
if self.built_ins.is_empty() {
115127
return BTreeSet::new();

crates/solidity/outputs/cargo/tests/src/cst/generated/mod.rs

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/solidity/outputs/spec/generated/public/supported-versions.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/solidity/testing/snapshots/bindings_output/built_ins/function_type/generated/0.4.21-failure.txt renamed to crates/solidity/testing/snapshots/bindings_output/built_ins/function_type/generated/0.4.17-failure.txt

File renamed without changes.

crates/solidity/testing/snapshots/bindings_output/built_ins/function_type/generated/0.8.4-success.txt renamed to crates/solidity/testing/snapshots/bindings_output/built_ins/function_type/generated/0.8.2-success.txt

File renamed without changes.

crates/solidity/testing/snapshots/bindings_output/built_ins/function_type/v2/generated/0.4.21-failure.txt renamed to crates/solidity/testing/snapshots/bindings_output/built_ins/function_type/v2/generated/0.4.17-failure.txt

File renamed without changes.

0 commit comments

Comments
 (0)