Skip to content

Dart throws unexpected unhandled exception when checks bounds of function type alias with invariant generic function type parameter. #45322

Closed
@iarkh

Description

@iarkh

Dart SDK version: 2.13.0-114.0.dev (dev) (Sat Mar 6 18:27:50 2021 -0800) on "windows_x64"

Here is a source code example which demonstrates the failure:

typedef void TEST<T extends void Function<TT>(TT)>();
void testme<T extends void Function<TT>(TT)>() {}

main() {
  TEST t = testme;
}

Sample output is:

$>dart --enable-experiment=generic-metadata test.dart
Unhandled exception:
type '<X0>(X0) => void' is not a subtype of type '<X1>(dynamic) => void' of 'T'
#0      _boundsCheckForPartialInstantiation (dart:_internal-patch/internal_patch.dart:147:57)
#1      main (file:///D:/DART/sdk/tests/co19/src/LanguageFeatures/Generic-functions-as-type-args/test.dart)
#2      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:283:19)
#3      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

Similar covariant case passes OK without any errors or warnings.

Metadata

Metadata

Assignees

Labels

area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.crashProcess exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions