Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests (and spelunker reporting) crash on test files that fail to parse #2956

Open
srawlins opened this issue Sep 16, 2021 · 4 comments
Open
Labels
P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) type-code-health Internal changes to our tools and workflows to make them cleaner, simpler, or more maintainable type-test

Comments

@srawlins
Copy link
Member

Describe the issue

I tried to add this example to the avoid_shadowing_type_parameters lint rule test, at the very bottom of test_data/rules/avoid_shadowing_type_parameters.dart:

// Dart 2.14 introduced "generic functions as type arguments and bounds."
class F<T extends void Function<T>(T)> {} // LINT

This code analyzes clean with dart analyze, but the test crashes, in spelunker, maybe?

$ dart test -N avoid_shadowing_type_parameters
Building package executable... (6.1s)
Built test:test.
00:07 +0 -1: test/rule_test.dart: rule dart avoid_shadowing_type_parameters [E]
  Invalid argument(s): Content produced diagnostics when parsed:
    EXPECTED_TOKEN: Expected to find 'Function'. - 78:29

  package:analyzer/dart/analysis/utilities.dart 102:5  parseString
  package:analyzer/src/lint/util.dart 96:23            Spelunker.spelunk
  test/rule_test.dart 274:61                           testRule.<fn>

00:07 +0 -1: loading test/rule_test.dart
@pq
Copy link
Member

pq commented Sep 16, 2021

I think there's an issue w/ the line just before it:

typedef Predicate = bool <E>(E element); // OK

image

@pq
Copy link
Member

pq commented Sep 16, 2021

Coincidentally, I was literally late last night thinking more about #2760 which, if implemented, would have saved you from this headache.

@srawlins
Copy link
Member Author

Ah ha! Great catch! OK I've run the test I intended and can move forward.

This still shouldn't crash, right? I'll leave this open.

@pq
Copy link
Member

pq commented Sep 16, 2021

Totally. This is really confusing. Thanks!

@pq pq added type-code-health Internal changes to our tools and workflows to make them cleaner, simpler, or more maintainable type-test labels Sep 16, 2021
@pq pq changed the title Spelunker crashes on generic function type in type parameter bound tests (and spelunker reporting) crash on test files that fail to parse Sep 16, 2021
@pq pq added the P3 A lower priority bug or feature request label Nov 14, 2022
@srawlins srawlins added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) type-code-health Internal changes to our tools and workflows to make them cleaner, simpler, or more maintainable type-test
Projects
None yet
Development

No branches or pull requests

2 participants