From fb10b2fcb185f1a14e79efdade9faf007f40d70d Mon Sep 17 00:00:00 2001 From: Daniel Frederico Lins Leite Date: Wed, 12 Nov 2025 14:16:20 -0300 Subject: [PATCH] Forbid const generics on abis (#7483) ## Description This PR forbids "const generics" on `abi`s. The reason is that to correctly support it, we will need to introduce changes to the ABI json. This will be reserved to the future. ## Checklist - [ ] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [x] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. --- > [!NOTE] > [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) is generating a summary for commit 1bf3210a097d76c7edafe81f2d0380dd0d5afadb. Configure [here](https://cursor.com/dashboard?tab=bugbot). --- sway-core/src/language/ty/declaration/abi.rs | 133 +++++++++++++ .../ast_node/declaration/abi.rs | 3 + .../src/type_system/substitute/subst_map.rs | 47 +++-- .../Forc.lock | 12 +- .../Forc.toml | 2 +- .../snapshot.toml | 0 .../src/main.sw | 24 +++ .../stdout.snap | 182 +++++++++++++----- 8 files changed, 329 insertions(+), 74 deletions(-) rename test/src/e2e_vm_tests/test_programs/should_fail/{const_generics => unsupported_const_generics}/Forc.lock (50%) rename test/src/e2e_vm_tests/test_programs/should_fail/{const_generics => unsupported_const_generics}/Forc.toml (81%) rename test/src/e2e_vm_tests/test_programs/should_fail/{const_generics => unsupported_const_generics}/snapshot.toml (100%) rename test/src/e2e_vm_tests/test_programs/should_fail/{const_generics => unsupported_const_generics}/src/main.sw (75%) rename test/src/e2e_vm_tests/test_programs/should_fail/{const_generics => unsupported_const_generics}/stdout.snap (50%) diff --git a/sway-core/src/language/ty/declaration/abi.rs b/sway-core/src/language/ty/declaration/abi.rs index fded97596d..219d71882d 100644 --- a/sway-core/src/language/ty/declaration/abi.rs +++ b/sway-core/src/language/ty/declaration/abi.rs @@ -1,5 +1,7 @@ use super::{TyDeclParsedType, TyTraitInterfaceItem, TyTraitItem}; use crate::{ + ast_elements::type_parameter::ConstGenericExpr, + decl_engine::DeclEngineGet as _, engine_threading::*, language::parsed::{self, AbiDeclaration}, transform, @@ -7,6 +9,10 @@ use crate::{ }; use serde::{Deserialize, Serialize}; use std::hash::{Hash, Hasher}; +use sway_error::{ + error::CompileError, + handler::{ErrorEmitted, Handler}, +}; use sway_types::{Ident, Named, Span, Spanned}; /// A [TyAbiDecl] contains the type-checked version of the parse tree's @@ -23,6 +29,133 @@ pub struct TyAbiDecl { pub attributes: transform::Attributes, } +fn has_const_generics(type_id: TypeId, engines: &Engines) -> bool { + let types = type_id.extract_any_including_self(engines, &|_| true, vec![], 0); + + for (t, _) in types { + let t = engines.te().get(t); + match &*t { + TypeInfo::StringArray(length) => match length.expr() { + ConstGenericExpr::Literal { .. } => {} + ConstGenericExpr::AmbiguousVariableExpression { .. } => return true, + }, + TypeInfo::Enum(decl_id) => { + let decl = engines.de().get(decl_id); + let any_const_generics = decl + .generic_parameters + .iter() + .any(|x| x.as_const_parameter().is_some()); + if any_const_generics { + return true; + } + } + TypeInfo::Struct(decl_id) => { + let decl = engines.de().get(decl_id); + let any_const_generics = decl + .generic_parameters + .iter() + .any(|x| x.as_const_parameter().is_some()); + if any_const_generics { + return true; + } + + for field in decl.fields.iter() { + let any_const_generics = + has_const_generics(field.type_argument.type_id, engines); + if any_const_generics { + return true; + } + } + } + TypeInfo::Tuple(items) => { + for item in items { + let any_const_generics = has_const_generics(item.type_id, engines); + if any_const_generics { + return true; + } + } + } + TypeInfo::Array(item, length) => { + let any_const_generics = has_const_generics(item.type_id, engines); + if any_const_generics { + return true; + } + + match length.expr() { + ConstGenericExpr::Literal { .. } => {} + ConstGenericExpr::AmbiguousVariableExpression { .. } => return true, + } + } + _ => {} + } + } + + false +} + +impl TyAbiDecl { + pub(crate) fn forbid_const_generics( + &self, + handler: &Handler, + engines: &Engines, + ) -> Result<(), ErrorEmitted> { + for item in self.interface_surface.iter() { + match item { + TyTraitInterfaceItem::TraitFn(decl_ref) => { + let decl = engines.de().get(decl_ref.id()); + + if has_const_generics(decl.return_type.type_id, engines) { + let err = handler.emit_err(CompileError::ConstGenericNotSupportedHere { + span: decl.return_type.span(), + }); + return Err(err); + } + + for arg in decl.parameters.iter() { + if has_const_generics(arg.type_argument.type_id, engines) { + let err = + handler.emit_err(CompileError::ConstGenericNotSupportedHere { + span: arg.type_argument.span.clone(), + }); + return Err(err); + } + } + } + TyTraitInterfaceItem::Constant(_) => {} + TyTraitInterfaceItem::Type(_) => {} + } + } + + for item in self.items.iter() { + match item { + TyTraitItem::Fn(decl_ref) => { + let decl = engines.de().get(decl_ref.id()); + if has_const_generics(decl.return_type.type_id, engines) { + let err = handler.emit_err(CompileError::ConstGenericNotSupportedHere { + span: decl.return_type.span(), + }); + return Err(err); + } + + for arg in decl.parameters.iter() { + if has_const_generics(arg.type_argument.type_id, engines) { + let err = + handler.emit_err(CompileError::ConstGenericNotSupportedHere { + span: arg.type_argument.span.clone(), + }); + return Err(err); + } + } + } + TyTraitItem::Constant(_) => {} + TyTraitItem::Type(_) => {} + } + } + + Ok(()) + } +} + impl TyDeclParsedType for TyAbiDecl { type ParsedType = AbiDeclaration; } diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/abi.rs b/sway-core/src/semantic_analysis/ast_node/declaration/abi.rs index 2f2df3f0d1..9816b56449 100644 --- a/sway-core/src/semantic_analysis/ast_node/declaration/abi.rs +++ b/sway-core/src/semantic_analysis/ast_node/declaration/abi.rs @@ -233,6 +233,9 @@ impl ty::TyAbiDecl { span, attributes, }; + + abi_decl.forbid_const_generics(handler, engines)?; + Ok(abi_decl) }) } diff --git a/sway-core/src/type_system/substitute/subst_map.rs b/sway-core/src/type_system/substitute/subst_map.rs index 84a9543542..0cc4973110 100644 --- a/sway-core/src/type_system/substitute/subst_map.rs +++ b/sway-core/src/type_system/substitute/subst_map.rs @@ -198,18 +198,18 @@ impl TypeSubstMap { (TypeInfo::Enum(decl_ref_params), TypeInfo::Enum(decl_ref_args)) => { let decl_params = decl_engine.get_enum(decl_ref_params); let decl_args = decl_engine.get_enum(decl_ref_args); - let type_parameters = decl_params.generic_parameters.iter().map(|x| { - let x = x - .as_type_parameter() - .expect("will only work with type parameters"); - x.type_id - }); - let type_arguments = decl_args.generic_parameters.iter().map(|x| { - let x = x - .as_type_parameter() - .expect("will only work with type parameters"); - x.type_id - }); + + let type_parameters = decl_params + .generic_parameters + .iter() + .filter_map(|x| x.as_type_parameter()) + .map(|x| x.type_id); + let type_arguments = decl_args + .generic_parameters + .iter() + .filter_map(|x| x.as_type_parameter()) + .map(|x| x.type_id); + TypeSubstMap::from_superset_and_subset_helper( engines, type_parameters, @@ -220,18 +220,17 @@ impl TypeSubstMap { let decl_params = decl_engine.get_struct(decl_ref_params); let decl_args = decl_engine.get_struct(decl_ref_args); - let type_parameters = decl_params.generic_parameters.iter().map(|x| { - let x = x - .as_type_parameter() - .expect("only works with type parameters"); - x.type_id - }); - let type_arguments = decl_args.generic_parameters.iter().map(|x| { - let x = x - .as_type_parameter() - .expect("only works with type parameters"); - x.type_id - }); + let type_parameters = decl_params + .generic_parameters + .iter() + .filter_map(|x| x.as_type_parameter()) + .map(|x| x.type_id); + let type_arguments = decl_args + .generic_parameters + .iter() + .filter_map(|x| x.as_type_parameter()) + .map(|x| x.type_id); + TypeSubstMap::from_superset_and_subset_helper( engines, type_parameters, diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/const_generics/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/Forc.lock similarity index 50% rename from test/src/e2e_vm_tests/test_programs/should_fail/const_generics/Forc.lock rename to test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/Forc.lock index fdf8afbbe1..18b1624216 100644 --- a/test/src/e2e_vm_tests/test_programs/should_fail/const_generics/Forc.lock +++ b/test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/Forc.lock @@ -1,8 +1,8 @@ -[[package]] -name = "const_generics" -source = "member" -dependencies = ["std"] - [[package]] name = "std" -source = "path+from-root-04B19932ACF7269D" +source = "path+from-root-73072EFA61E741F9" + +[[package]] +name = "unsupported_const_generics" +source = "member" +dependencies = ["std"] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/const_generics/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/Forc.toml similarity index 81% rename from test/src/e2e_vm_tests/test_programs/should_fail/const_generics/Forc.toml rename to test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/Forc.toml index 444552229f..0b9a40c69b 100644 --- a/test/src/e2e_vm_tests/test_programs/should_fail/const_generics/Forc.toml +++ b/test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/Forc.toml @@ -2,7 +2,7 @@ authors = ["Fuel Labs "] entry = "main.sw" license = "Apache-2.0" -name = "const_generics" +name = "unsupported_const_generics" [dependencies] std = { path = "../../../../../../sway-lib-std" } diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/const_generics/snapshot.toml b/test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/snapshot.toml similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_fail/const_generics/snapshot.toml rename to test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/snapshot.toml diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw similarity index 75% rename from test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw rename to test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw index bda13abebe..919294c1c0 100644 --- a/test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw @@ -42,6 +42,30 @@ impl A for CrazyEnum { } } +abi NoConstGenericsOnArgs { + fn f(a: CrazyStruct<1>); +} + +abi NoConstGenericsOnReturn { + fn f() -> CrazyEnum<1>; +} + +struct StructWithConstGenericInside { + a: CrazyStruct<1>, +} + +abi NoConstGenericsIndirectStruct { + fn f() -> StructWithConstGenericInside; +} + +enum EnumWithConstGenericInside { + A: CrazyStruct<1>, +} + +abi NoConstGenericsIndirectEnum { + fn f() -> EnumWithConstGenericInside; +} + fn main() { let _: CrazyStruct = CrazyStruct { }; let _: CrazyEnum = CrazyEnum::A; diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/const_generics/stdout.snap b/test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/stdout.snap similarity index 50% rename from test/src/e2e_vm_tests/test_programs/should_fail/const_generics/stdout.snap rename to test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/stdout.snap index 232946d6c8..c0acb23ea6 100644 --- a/test/src/e2e_vm_tests/test_programs/should_fail/const_generics/stdout.snap +++ b/test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/stdout.snap @@ -1,14 +1,26 @@ --- source: test/src/snapshot/mod.rs --- -> forc build --path test/src/e2e_vm_tests/test_programs/should_fail/const_generics --experimental const_generics +> forc build --path test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics --experimental const_generics exit status: 1 output: - Building test/src/e2e_vm_tests/test_programs/should_fail/const_generics + Building test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics Compiling library std (sway-lib-std) - Compiling script const_generics (test/src/e2e_vm_tests/test_programs/should_fail/const_generics) + Compiling script unsupported_const_generics (test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics) warning - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:24:5 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:62:5 + | +60 | +61 | enum EnumWithConstGenericInside { +62 | A: CrazyStruct<1>, + | - Enum variant A is never constructed. +63 | } +64 | + | +____ + +warning + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:24:5 | 22 | 23 | impl A for CrazyStruct { @@ -22,7 +34,7 @@ warning ____ warning - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:41:5 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:41:5 | 39 | 40 | impl A for CrazyEnum { @@ -35,8 +47,44 @@ warning | ____ +warning + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:53:8 + | +51 | } +52 | +53 | struct StructWithConstGenericInside { + | ---------------------------- This struct is never used. +54 | a: CrazyStruct<1>, +55 | } + | +____ + +warning + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:54:5 + | +52 | +53 | struct StructWithConstGenericInside { +54 | a: CrazyStruct<1>, + | - This struct field is never accessed. +55 | } +56 | + | +____ + +warning + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:61:6 + | +59 | } +60 | +61 | enum EnumWithConstGenericInside { + | -------------------------- This enum is never used. +62 | A: CrazyStruct<1>, +63 | } + | +____ + error: Multiple definitions of constant - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:6:63 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:6:63 | ... 6 | struct RepeatedConstGenericsNameInStructs { } @@ -46,7 +94,7 @@ error: Multiple definitions of constant ____ error: Multiple definitions of constant - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:7:59 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:7:59 | ... 7 | enum RepeatedConstGenericsNameInEnums { } @@ -56,7 +104,7 @@ error: Multiple definitions of constant ____ error: Multiple definitions of constant - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:8:61 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:8:61 | ... 8 | trait RepeatedConstGenericsNameInTraits { } @@ -66,7 +114,7 @@ error: Multiple definitions of constant ____ error: Multiple definitions of constant - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:10:53 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:10:53 | ... 10 | fn repeated_const_generics_name() { @@ -76,7 +124,7 @@ error: Multiple definitions of constant ____ error: Multiple definitions of constant - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:15:26 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:15:26 | ... 15 | impl CrazyStruct { @@ -86,7 +134,7 @@ error: Multiple definitions of constant ____ error: Multiple definitions of constant - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:19:71 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:19:71 | ... 19 | fn repeated_const_generics_name() { @@ -96,7 +144,7 @@ error: Multiple definitions of constant ____ error: Multiple definitions of constant - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:19:43 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:19:43 | ... 18 | impl CrazyStruct { @@ -107,7 +155,7 @@ error: Multiple definitions of constant ____ error: Multiple definitions of constant - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:24:73 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:24:73 | ... 24 | fn repeated_const_generics_name_2() { @@ -117,7 +165,7 @@ error: Multiple definitions of constant ____ error: Multiple definitions of constant - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:24:45 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:24:45 | ... 23 | impl A for CrazyStruct { @@ -128,7 +176,7 @@ error: Multiple definitions of constant ____ error: Multiple definitions of constant - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:32:26 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:32:26 | ... 32 | impl CrazyEnum { @@ -138,7 +186,7 @@ error: Multiple definitions of constant ____ error: Multiple definitions of constant - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:36:71 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:36:71 | ... 36 | fn repeated_const_generics_name() { @@ -148,7 +196,7 @@ error: Multiple definitions of constant ____ error: Multiple definitions of constant - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:36:43 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:36:43 | ... 35 | impl CrazyEnum { @@ -159,7 +207,7 @@ error: Multiple definitions of constant ____ error: Multiple definitions of constant - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:41:73 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:41:73 | ... 41 | fn repeated_const_generics_name_2() { @@ -169,7 +217,7 @@ error: Multiple definitions of constant ____ error: Multiple definitions of constant - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:41:45 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:41:45 | ... 40 | impl A for CrazyEnum { @@ -180,51 +228,99 @@ error: Multiple definitions of constant ____ error - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:46:24 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:46:13 | 44 | -45 | fn main() { -46 | let _: CrazyStruct = CrazyStruct { }; +45 | abi NoConstGenericsOnArgs { +46 | fn f(a: CrazyStruct<1>); + | ^^^^^^^^^^^^^^ "const generics" are not supported here. +47 | } +48 | + | +____ + +error + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:50:15 + | +48 | +49 | abi NoConstGenericsOnReturn { +50 | fn f() -> CrazyEnum<1>; + | ^^^^^^^^^^^^ "const generics" are not supported here. +51 | } +52 | + | +____ + +error + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:58:15 + | +56 | +57 | abi NoConstGenericsIndirectStruct { +58 | fn f() -> StructWithConstGenericInside; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "const generics" are not supported here. +59 | } +60 | + | +____ + +error + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:66:15 + | +64 | +65 | abi NoConstGenericsIndirectEnum { +66 | fn f() -> EnumWithConstGenericInside; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ "const generics" are not supported here. +67 | } +68 | + | +____ + +error + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:70:24 + | +68 | +69 | fn main() { +70 | let _: CrazyStruct = CrazyStruct { }; | ^^^^^^^ Could not find symbol "UNKNOWN" in this scope. -47 | let _: CrazyEnum = CrazyEnum::A; -48 | let _: [u8; UNKNOWN] = [1u8]; +71 | let _: CrazyEnum = CrazyEnum::A; +72 | let _: [u8; UNKNOWN] = [1u8]; | ____ error - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:47:22 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:71:22 | -45 | fn main() { -46 | let _: CrazyStruct = CrazyStruct { }; -47 | let _: CrazyEnum = CrazyEnum::A; +69 | fn main() { +70 | let _: CrazyStruct = CrazyStruct { }; +71 | let _: CrazyEnum = CrazyEnum::A; | ^^^^^^^ Could not find symbol "UNKNOWN" in this scope. -48 | let _: [u8; UNKNOWN] = [1u8]; -49 | let _: str[UNKNOWN] = __to_str_array("abc"); +72 | let _: [u8; UNKNOWN] = [1u8]; +73 | let _: str[UNKNOWN] = __to_str_array("abc"); | ____ error - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:48:17 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:72:17 | -46 | let _: CrazyStruct = CrazyStruct { }; -47 | let _: CrazyEnum = CrazyEnum::A; -48 | let _: [u8; UNKNOWN] = [1u8]; +70 | let _: CrazyStruct = CrazyStruct { }; +71 | let _: CrazyEnum = CrazyEnum::A; +72 | let _: [u8; UNKNOWN] = [1u8]; | ^^^^^^^ Could not find symbol "UNKNOWN" in this scope. -49 | let _: str[UNKNOWN] = __to_str_array("abc"); -50 | } +73 | let _: str[UNKNOWN] = __to_str_array("abc"); +74 | } | ____ error - --> test/src/e2e_vm_tests/test_programs/should_fail/const_generics/src/main.sw:49:16 + --> test/src/e2e_vm_tests/test_programs/should_fail/unsupported_const_generics/src/main.sw:73:16 | -47 | let _: CrazyEnum = CrazyEnum::A; -48 | let _: [u8; UNKNOWN] = [1u8]; -49 | let _: str[UNKNOWN] = __to_str_array("abc"); +71 | let _: CrazyEnum = CrazyEnum::A; +72 | let _: [u8; UNKNOWN] = [1u8]; +73 | let _: str[UNKNOWN] = __to_str_array("abc"); | ^^^^^^^ Could not find symbol "UNKNOWN" in this scope. -50 | } +74 | } | ____ - Aborting due to 18 errors. -error: Failed to compile const_generics + Aborting due to 22 errors. +error: Failed to compile unsupported_const_generics