@@ -15,7 +15,7 @@ final class LookupResult<T> {
1515
1616 /// If a match, does not consume the full path, then stores the [remaining]
1717 ///
18- /// This can only happen with path that ends with a tail-match /:: or /::name ,
18+ /// This can only happen with a path that ends with a tail segment `/**` ,
1919 /// otherwise it will be empty.
2020 final NormalizedPath remaining;
2121
@@ -55,8 +55,8 @@ final class _Tail<T> extends _DynamicSegment<T> {}
5555
5656/// A Trie (prefix tree) data structure optimized for matching URL paths.
5757///
58- /// Supports literal segments and parameterized segments (e.g., `:id` ). Allows
59- /// associating a value of type [T] with each complete path.
58+ /// Supports literal segments, parameterized segments (e.g., `:id` ), wildcard segments ( `*` ),
59+ /// and tail segments ( `**` ). Allows associating a value of type [T] with each complete path.
6060final class PathTrie <T > {
6161 // Note: not final since we update in attach
6262 var _root = _TrieNode <T >();
@@ -215,16 +215,11 @@ final class PathTrie<T> {
215215 void isA <U extends _DynamicSegment <T >>(
216216 final _DynamicSegment <T >? dynamicSegment, final int segmentNo) {
217217 if (dynamicSegment != null && dynamicSegment is ! U ) {
218- final kind = switch (dynamicSegment) {
219- _Parameter <T >() => 'parameter ":name"' ,
220- _Wildcard <T >() => 'wildcard "*"' ,
221- _Tail <T >() => 'tail "**"' ,
222- };
223218 normalizedPath.raiseInvalidSegment (
224219 segmentNo,
225220 'Conflicting segment type at the same level: '
226- 'Existing: $kind , '
227- 'New: "$ U " ' );
221+ 'Existing: ${ dynamicSegment . runtimeType } , '
222+ 'New: $ U ' );
228223 }
229224 }
230225
@@ -264,7 +259,7 @@ final class PathTrie<T> {
264259 parameter = _Parameter (paramName);
265260 } else if (parameter.name != paramName) {
266261 // Throw an error if a different parameter name already exists at this level.
267- throw normalizedPath.raiseInvalidSegment (
262+ normalizedPath.raiseInvalidSegment (
268263 i,
269264 'Conflicting parameter names at the same level: '
270265 'Existing: ":${parameter .name }", '
0 commit comments