Skip to content

Commit

Permalink
Add enum variant attributes to TyProgram (#3027)
Browse files Browse the repository at this point in the history
It seems we missed the enum variant attributes when merging in #2979 

Found while refactoring `forc doc`

Closes #3034
  • Loading branch information
eureka-cpu authored Oct 14, 2022
1 parent 185a0a7 commit d8485d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions sway-core/src/language/ty/declaration/enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pub struct TyEnumVariant {
pub type_span: Span,
pub(crate) tag: usize,
pub(crate) span: Span,
pub attributes: AttributesMap,
}

// NOTE: Hash and PartialEq must uphold the invariant:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ impl ty::TyEnumVariant {
type_span: variant.type_span.clone(),
tag: variant.tag,
span: variant.span,
attributes: variant.attributes,
},
vec![],
errors,
Expand Down
4 changes: 3 additions & 1 deletion sway-core/src/type_system/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use sway_types::{integer_bits::IntegerBits, Span};

#[test]
fn generic_enum_resolution() {
use crate::{language::ty, span::Span, Ident};
use crate::{language::ty, span::Span, AttributesMap, Ident};
let engine = TypeEngine::default();

let sp = Span::dummy();
Expand All @@ -50,6 +50,7 @@ fn generic_enum_resolution() {
}),
span: sp.clone(),
type_span: sp.clone(),
attributes: AttributesMap::default(),
}];

let ty_1 = engine.insert_type(TypeInfo::Enum {
Expand All @@ -65,6 +66,7 @@ fn generic_enum_resolution() {
initial_type_id: engine.insert_type(TypeInfo::Boolean),
span: sp.clone(),
type_span: sp.clone(),
attributes: AttributesMap::default(),
}];

let ty_2 = engine.insert_type(TypeInfo::Enum {
Expand Down

0 comments on commit d8485d6

Please sign in to comment.