glob
glob copied to clipboard
"Bad state: no element" for "{**/,}foo.dart"
I'm not sure if this is a valid pattern, but while looking at #52880 I tried to use "{**/,}foo.dart", but it resulted in an exception:
print(Glob('{**/,}foo.dart').matches("c:\\foo\\bar.txt"));
Unhandled exception:
Bad state: No element
#0 List.first (dart:core-patch/growable_array.dart:343:5)
#1 SequenceNode.canMatchAbsolute (package:glob/src/ast.dart:60:38)
#2 OptionsNode.canMatchAbsolute.<anonymous closure> (package:glob/src/ast.dart:371:59)
#3 ListBase.any (dart:collection/list.dart:114:15)
#4 OptionsNode.canMatchAbsolute (package:glob/src/ast.dart:371:40)
#5 SequenceNode.canMatchAbsolute (package:glob/src/ast.dart:60:44)
#6 Glob._patternCanMatchAbsolute (package:glob/glob.dart:70:46)
#7 Glob.matchAsPrefix (package:glob/glob.dart:162:9)
#8 Glob.matches (package:glob/glob.dart:154:32)
#9 main (file:///C:/Dev/Test%20Projects/blogtest/bin/blogtest.dart:5:32)
#10 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:294:33)
#11 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)
If the pattern is invalid and exception is expected, it should be more descriptive than this.