Skip to content

Commit f1788b5

Browse files
authored
Actually run the named type tests and then get them passing. (#1282)
In #1281, I forgot that adding a new test subdirectory doesn't actually run its tests so they weren't being run. That in turn meant that I forgot to actually implement support for library prefixes and nullable types. Oops.
1 parent d8baf12 commit f1788b5

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

lib/src/front_end/ast_node_visitor.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -618,14 +618,14 @@ class AstNodeVisitor extends ThrowingAstVisitor<void>
618618

619619
@override
620620
void visitNamedType(NamedType node) {
621-
// TODO(tall): Handle import prefix.
622-
if (node.importPrefix != null) throw UnimplementedError();
621+
if (node.importPrefix case var importPrefix?) {
622+
token(importPrefix.name);
623+
token(importPrefix.period);
624+
}
623625

624626
token(node.name2);
625627
visit(node.typeArguments);
626-
627-
// TODO(tall): Handle nullable types.
628-
if (node.question != null) throw UnimplementedError();
628+
token(node.question);
629629
}
630630

631631
@override

test/tall_format_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ void main() async {
1414
await testDirectory('invocation', tall: true);
1515
await testDirectory('statement', tall: true);
1616
await testDirectory('top_level', tall: true);
17+
await testDirectory('type', tall: true);
1718

1819
// TODO(tall): The old formatter_test.dart has tests here for things like
1920
// trailing newlines. Port those over to the new style once it supports all

test/type/named.stmt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ library_prefix.TypeName x;
1414
>>> Don't split on prefix.
1515
very_long_library_prefix . VeryLongTypeName x ;
1616
<<<
17-
very_long_library_prefix.VeryLongTypeName x;
17+
very_long_library_prefix.VeryLongTypeName
18+
x;
1819
>>> Prefixed nullable type.
1920
prefix . TypeName ? x ;
2021
<<<
@@ -31,13 +32,13 @@ Generic<
3132
AnotherLongType,
3233
ThirdOne
3334
> g;
34-
>>> Splitting in type argument forces type argument list to split.
35-
Generic<Map<LongTypeName, AnotherType>, ThirdOne> g;
35+
>>> Splitting in type argument forces outer type argument list to split.
36+
Generic<Map<LongTypeName, AnotherReallyLongType>, ThirdOne> g;
3637
<<<
3738
Generic<
3839
Map<
3940
LongTypeName,
40-
AnotherType
41+
AnotherReallyLongType
4142
>,
4243
ThirdOne
4344
> g;

0 commit comments

Comments
 (0)