// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. // dart2jsOptions=--strong // Regression test for http://dartbug.com/28749. // // This would crash at compile time because inner typedefs remain after calling // [type.unalias]. Expanding the typedef causes the inputs to be used multiple // types, breaking the invariant of HTypeInfoExpression that the type variable // occurrences correspond to inputs. import 'package:expect/expect.dart'; typedef void F(T value); typedef F Converter(F function); typedef Converter ConvertFactory(int input); class B { final field = new Wrap>(); @pragma('dart2js:noInline') B(); } class Wrap { @pragma('dart2js:noInline') Wrap(); } foo(int x) { if (x == 0) return new Wrap>().runtimeType; else return new B().field.runtimeType; } void main() { var name = '${Wrap}'; if ('$Object' != 'Object') return; // minified Expect.equals( 'Wrap<(int) => ((int) => void) => (int) => void>', '${new B().field.runtimeType}', ); Expect.equals( 'Wrap<(int) => ((bool) => void) => (bool) => void>', '${new B().field.runtimeType}', ); Expect.equals( 'Wrap<(int) => ((int) => void) => (int) => void>', '${foo(0)}', ); Expect.equals( 'Wrap<(int) => ((String) => void) => (String) => void>', '${foo(1)}', ); }