Skip to content

Commit defcba3

Browse files
committed
Update xls_dslx_fmt_test for std.x after using generics
1 parent e0bcd2b commit defcba3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

xls/dslx/fmt/ast_fmt.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,12 @@ DocRef Fmt(const ChannelTypeAnnotation& n, Comments& comments,
416416
return ConcatNGroup(arena, pieces);
417417
}
418418

419+
DocRef Fmt(const TypeVariableTypeAnnotation& n, Comments& comments,
420+
DocArena& arena) {
421+
std::vector<DocRef> pieces = {Fmt(*n.type_variable(), comments, arena)};
422+
return ConcatNGroup(arena, pieces);
423+
}
424+
419425
DocRef Fmt(const TypeAnnotation& n, Comments& comments, DocArena& arena) {
420426
if (auto* t = dynamic_cast<const BuiltinTypeAnnotation*>(&n)) {
421427
return Fmt(*t, comments, arena);
@@ -432,6 +438,12 @@ DocRef Fmt(const TypeAnnotation& n, Comments& comments, DocArena& arena) {
432438
if (auto* t = dynamic_cast<const ChannelTypeAnnotation*>(&n)) {
433439
return Fmt(*t, comments, arena);
434440
}
441+
if (auto* t = dynamic_cast<const TypeVariableTypeAnnotation*>(&n)) {
442+
return Fmt(*t, comments, arena);
443+
}
444+
if (dynamic_cast<const GenericTypeAnnotation*>(&n)) {
445+
return arena.Make(Keyword::kType);
446+
}
435447
if (dynamic_cast<const SelfTypeAnnotation*>(&n)) {
436448
return arena.Make(Keyword::kSelfType);
437449
}

xls/dslx/stdlib/std.x

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
pub fn enumerate<T: type, N: u32>(x: T[N]) -> (u32, T)[N] {
2020
for (i, result): (u32, (u32, T)[N]) in u32:0..N {
2121
update(result, i, (i, x[i]))
22-
}(((u32, T)[N]: [(u32:0, zero!<T>()), ...]))
22+
}(((u32, T)[N]:[(u32:0, zero!<T>()), ...]))
2323
}
2424

2525
#[test]
@@ -35,7 +35,7 @@ fn emumerate_test() {
3535
#[test]
3636
fn enumerate_type_test() {
3737
type RamData = uN[8];
38-
const DATA = RamData[4]: [RamData:1, RamData:2, RamData:4, RamData:8];
38+
const DATA = RamData[4]:[RamData:1, RamData:2, RamData:4, RamData:8];
3939
let enumerated = enumerate(DATA);
4040
assert_eq(enumerated[u32:0], (u32:0, u8:1));
4141
assert_eq(enumerated[u32:1], (u32:1, u8:2));

0 commit comments

Comments
 (0)