Add test that currently crash DDC with kernel because of illegal js name

The named import makes it into the kernel class name (meaning it has a
dot in it). That is currently not cleaned up when creating js code,
but it is catched as a non-legal js identifier.

```
Unhandled exception:
Invalid argument (name): not a valid identifier: "_Object$collection.ListMixin"
#0      new Identifier (package:dev_compiler/src/js_ast/nodes.dart:1148)
#1      ProgramCompiler._emitClassStatement (package:dev_compiler/src/kernel/compiler.dart:573)
#2      ProgramCompiler._defineClass (package:dev_compiler/src/kernel/compiler.dart:679)
#3      ProgramCompiler._emitClassDeclaration (package:dev_compiler/src/kernel/compiler.dart:501)
#4      ProgramCompiler._emitClass (package:dev_compiler/src/kernel/compiler.dart:450)
#5      List.forEach (dart:core-patch/dart:core/growable_array.dart:274)
#6      ProgramCompiler._emitLibrary (package:dev_compiler/src/kernel/compiler.dart:393)
#7      Iterable.forEach (dart:core/iterable.dart:226)
#8      ProgramCompiler.emitProgram (package:dev_compiler/src/kernel/compiler.dart:282)
#9      compileToJSModule (package:dev_compiler/src/kernel/command.dart:166)
#10     _compile (package:dev_compiler/src/kernel/command.dart:145)
```

Bug:
Change-Id: Ibb5a1c908c2ddba63600446f6062ced1b5dd34c2
Reviewed-on: https://dart-review.googlesource.com/28662
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This commit is contained in:
Jens Johansen 2017-12-12 13:36:50 +00:00 committed by commit-bot@chromium.org
parent 3311d3c552
commit d00bc2e89b
2 changed files with 17 additions and 0 deletions

View file

@ -546,6 +546,7 @@ mixin_type_parameters_errors_test/02: MissingCompileTimeError
mixin_type_parameters_errors_test/03: MissingCompileTimeError
mixin_type_parameters_errors_test/04: MissingCompileTimeError
mixin_type_parameters_errors_test/05: MissingCompileTimeError
mixin_with_named_import_test: Crash
multiline_newline_test/06: MissingCompileTimeError
multiline_newline_test/06r: MissingCompileTimeError
named_constructor_test/01: MissingCompileTimeError

View file

@ -0,0 +1,16 @@
// 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.
import 'dart:collection' as collection;
class Foo extends Object with collection.ListMixin {
int get length => 0;
operator [](int index) => null;
void operator []=(int index, value) => null;
set length(int newLength) => null;
}
main() {
new Foo();
}