Skip to content

Commit

Permalink
[slang] Make string simple type (#1049)
Browse files Browse the repository at this point in the history
  • Loading branch information
likeamahoney committed Jul 8, 2024
1 parent 4221f2f commit 3d4ad50
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/ast/types/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ bool Type::isSimpleType() const {
case SymbolKind::FloatingType:
case SymbolKind::TypeAlias:
case SymbolKind::ClassType:
case SymbolKind::StringType:
return true;
default:
return false;
Expand Down
22 changes: 22 additions & 0 deletions tests/unittests/ast/MemberTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2756,3 +2756,25 @@ endmodule
]
})");
}

TEST_CASE("IEEE 1800 Section 10.9.2 - structure assignment patterns") {
auto tree = SyntaxTree::fromText(R"(
module top;
typedef struct {
logic [7:0] a;
bit b;
bit signed [31:0] c;
string s;
} sa;
sa s2;
initial s2 = '{int:1, default:0, string:""}; // set all to 0 except the
// array of bits to 1 and
// string to ""
endmodule
)");

Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
}

0 comments on commit 3d4ad50

Please sign in to comment.