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

Unhandled exception: type 'FunctionTypeImpl' is not a subtype of type 'InterfaceType' #2101

Closed
isoos opened this issue Dec 19, 2019 · 6 comments · Fixed by #2109
Closed

Unhandled exception: type 'FunctionTypeImpl' is not a subtype of type 'InterfaceType' #2101

isoos opened this issue Dec 19, 2019 · 6 comments · Fixed by #2109
Assignees
Labels
P0 A serious issue requiring immediate resolution

Comments

@isoos
Copy link
Contributor

isoos commented Dec 19, 2019

The following exception happened while running dartdoc 0.29.1 on plexus 4.0.0+5 on pub.dev:

documenting plexus
Generating docs for library expose from package:plexus/expose.dart...

STDERR:
Documenting plexus...
  warning: expose has no library level documentation comments, from expose: (file:///tmp/pub-dartlang-dartdocGFHAYO/pkg/lib/expose.dart:1:9)
Unhandled exception:
type 'FunctionTypeImpl' is not a subtype of type 'InterfaceType'
#0      DefinedElementType.interfaceType (package:dartdoc/src/element_type.dart:324:38)
#1      DefinedElementType.instantiatedType (package:dartdoc/src/element_type.dart:331:12)
#2      Extension._couldApplyTo (package:dartdoc/src/model.dart:1350:47)
#3      Extension.couldApplyTo (package:dartdoc/src/model.dart:1346:33)
#4      Class.potentiallyApplicableExtensions.<anonymous closure> (package:dartdoc/src/model.dart:805:27)
#5      WhereIterator.moveNext (dart:_internal/iterable.dart:440:11)
@mpfaff
Copy link

mpfaff commented Dec 20, 2019

Here's the contents of expose.dart if it helps

library expose;

export 'package:plexus/src/expose/list.dart';
export 'package:plexus/src/expose/maps.dart';

@mpfaff
Copy link

mpfaff commented Dec 24, 2019

So it seems the issue is that dartdoc doesn't correctly handle library expose; not having documentation comments.

@jcollins-g jcollins-g added P0 A serious issue requiring immediate resolution Type: bug labels Jan 2, 2020
@jcollins-g jcollins-g self-assigned this Jan 2, 2020
@jcollins-g
Copy link
Contributor

The warning on library expose is a red herring; the exception is in some later processing loop. It looks like a mismatch of expectations between dartdoc and the analyzer for some reason, though I'm having difficulty reproducing this at head. Still investigating.

@jcollins-g
Copy link
Contributor

Crash reproduced; the crash only occurs with the --link-to-remote flag (used by pub and most modern users of dartdoc now).

@jcollins-g
Copy link
Contributor

code snippet below (inspired by the dartx package) will reproduce:

typedef R Function1<A, R>(A a);
typedef R Function2<A, B, R>(A a, B b);

extension DoSomething2X<A, B, R> on Function1<A, Function1<B, R>> {
  Function2<A, B, R> something() => (A first, B second) => this(first)(second);
}

@jcollins-g
Copy link
Contributor

jcollins-g commented Jan 2, 2020

root cause identified. Dartdoc does not understand much about extensions on function types (filed as #2107) and an edge case we did not test has broken us.

Until this issue is fixed, any package that includes an extension on a function type in its transitive dependencies will crash if being documented with --link-to-remote, or will crash if it itself uses them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 A serious issue requiring immediate resolution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants