dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.23k stars 1.57k forks source link

failing detecting type error (no error message), but subsequent importing the lib fails without error message #14497

Closed DartBot closed 9 years ago

DartBot commented 11 years ago

This issue was originally filed by nn...@gmail.com


What steps will reproduce the problem? 1.uncompress attached zip file 2.open sample_app/web/sample_common_generic_gui.dart in dart eclipse plugin, it does not recognize the importing class, Component from gui_component. Also top dart file, sample_app/web/sample_dynamic_generic_gui.dart does not recognize element(yellow line)

  1. open /gui_component/lib/src/gui_generic_table.dart, and comment out a line: List<ComponentAction> get listeners => table.row_listeners; ==> // List<ComponentAction> get listeners => table.row_listeners;
  2. and uncomment //List<RowAction> get listeners => table.row_listeners; ==> List<RowAction> get listeners => table.row_listeners;

This fixes this reported problem.


What is the expected output? What do you see instead? Should provide proper error messages when system fails to process program properly. I guess this is internal bug. This kind bug is hard to diagnose the cause of problem. and makes users skeptical for the overall quality of the system. Should be fixed with highest priority.

What version of the product are you using? On what operating system? r28355 and r28984

Please provide any additional information below.

The mentioned problem is just one of them.

Sometimes, this cause bunch of weird problem.

1) if we does not import using package, and use local path, it can succeed to import, but sometimes, even accessing packages using relative path for packages will fails, but if we create a link pointing to the same folder, it succeeds.

2) having resolved importing issues this way(using relative path), and run the dart code, in certain context, 'a is A' becomes false even if a is instance of A, and a.runtimeType == A is evaluated to false. but in a simple context, it will be evaluated properly.

So essentially, failed compiled code seems processed twices? The lack of error message makes it very hard to diagnose the real problem.

3) this problem would have been introduced after r27778, since the same code did not cause these problems.


Attachment: reflective_web_dev_kit.tar.gz (602.52 KB)

floitschG commented 11 years ago

Added Area-Editor, Triaged labels.

clayberg commented 11 years ago

Added this to the Later milestone. Removed Priority-Unassigned, Area-Editor labels. Added Priority-Medium, Area-Analyzer labels.

kasperl commented 10 years ago

Removed this from the Later milestone. Added Oldschool-Milestone-Later label.

bwilkerson commented 10 years ago

I believe that the problem is that type resolution is trying to perform type substitution on a function type alias before the function type has had type resolution performed on it. Because type resolution hasn't been performed the parameter types are null, leading to the NPE.

Here's the stack trace:

com.google.dart.engine.context.AnalysisException: Exception     at com.google.dart.engine.internal.task.AnalysisTask.safelyPerform(AnalysisTask.java:123)     at com.google.dart.engine.internal.task.AnalysisTask.perform(AnalysisTask.java:73)     at com.google.dart.engine.internal.context.AnalysisContextImpl.cacheDartResolutionData(AnalysisContextImpl.java:2689)     at com.google.dart.engine.internal.context.AnalysisContextImpl.getDartResolutionData(AnalysisContextImpl.java:3428)     at com.google.dart.engine.internal.context.AnalysisContextImpl.getDartResolutionData(AnalysisContextImpl.java:3460)     at com.google.dart.engine.internal.context.AnalysisContextImpl.computeLibraryElement(AnalysisContextImpl.java:1234)     at com.google.dart.engine.internal.resolver.Library.getLibraryElement(Library.java:249)     at com.google.dart.engine.internal.resolver.LibraryResolver.buildDirectiveModels(LibraryResolver.java:465)     at com.google.dart.engine.internal.resolver.LibraryResolver.resolveLibrary(LibraryResolver.java:297)     at com.google.dart.engine.internal.task.ResolveDartLibraryTask.internalPerform(ResolveDartLibraryTask.java:97)     at com.google.dart.engine.internal.task.AnalysisTask.safelyPerform(AnalysisTask.java:119)     at com.google.dart.engine.internal.task.AnalysisTask.perform(AnalysisTask.java:73)     at com.google.dart.engine.internal.context.AnalysisContextImpl.cacheDartResolutionData(AnalysisContextImpl.java:2689)     at com.google.dart.engine.internal.context.AnalysisContextImpl.getDartResolutionData(AnalysisContextImpl.java:3428)     at com.google.dart.engine.internal.context.AnalysisContextImpl.getDartResolutionData(AnalysisContextImpl.java:3460)     at com.google.dart.engine.internal.context.AnalysisContextImpl.computeLibraryElement(AnalysisContextImpl.java:1234)     at com.google.dart.engine.internal.resolver.Library.getLibraryElement(Library.java:249)     at com.google.dart.engine.internal.resolver.LibraryResolver.buildDirectiveModels(LibraryResolver.java:465)     at com.google.dart.engine.internal.resolver.LibraryResolver.resolveLibrary(LibraryResolver.java:297)     at com.google.dart.engine.internal.task.ResolveDartLibraryTask.internalPerform(ResolveDartLibraryTask.java:97)     at com.google.dart.engine.internal.task.AnalysisTask.safelyPerform(AnalysisTask.java:119)     at com.google.dart.engine.internal.task.AnalysisTask.perform(AnalysisTask.java:73)     at com.google.dart.engine.internal.context.AnalysisContextImpl.performAnalysisTask(AnalysisContextImpl.java:1917)     at com.google.dart.tools.core.internal.builder.AnalysisWorker.performAnalysis(AnalysisWorker.java:386)     at com.google.dart.tools.core.internal.builder.AnalysisManager.performAnalysis(AnalysisManager.java:148)     at com.google.dart.tools.core.internal.builder.AnalysisManager$1.run(AnalysisManager.java:184)     at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Caused by: java.lang.NullPointerException     at com.google.dart.engine.internal.type.TypeImpl.equalArrays(TypeImpl.java:82)     at com.google.dart.engine.internal.type.FunctionTypeImpl.internalEquals(FunctionTypeImpl.java:561)     at com.google.dart.engine.internal.type.FunctionTypeImpl.equals(FunctionTypeImpl.java:103)     at java.util.Arrays.equals(Arrays.java:2392)     at com.google.dart.engine.internal.type.InterfaceTypeImpl.substitute(InterfaceTypeImpl.java:653)     at com.google.dart.engine.internal.type.InterfaceTypeImpl.substitute(InterfaceTypeImpl.java:1)     at com.google.dart.engine.internal.type.FunctionTypeImpl.getReturnType(FunctionTypeImpl.java:266)     at com.google.dart.engine.internal.resolver.TypeResolverVisitor.visitMethodDeclaration(TypeResolverVisitor.java:471)     at com.google.dart.engine.internal.resolver.ScopedVisitor.visitMethodDeclaration(ScopedVisitor.java:1)     at com.google.dart.engine.ast.MethodDeclaration.accept(MethodDeclaration.java:118)     at com.google.dart.engine.internal.resolver.TypeResolverVisitor.visitClassMembersInScope(TypeResolverVisitor.java:862)     at com.google.dart.engine.internal.resolver.ScopedVisitor.visitClassDeclaration(ScopedVisitor.java:271)     at com.google.dart.engine.internal.resolver.TypeResolverVisitor.visitClassDeclaration(TypeResolverVisitor.java:274)     at com.google.dart.engine.internal.resolver.ScopedVisitor.visitClassDeclaration(ScopedVisitor.java:1)     at com.google.dart.engine.ast.ClassDeclaration.accept(ClassDeclaration.java:127)     at com.google.dart.engine.ast.NodeList.accept(NodeList.java:67)     at com.google.dart.engine.ast.CompilationUnit.visitChildren(CompilationUnit.java:216)     at com.google.dart.engine.ast.visitor.UnifyingAstVisitor.visitNode(UnifyingAstVisitor.java:377)     at com.google.dart.engine.ast.visitor.UnifyingAstVisitor.visitCompilationUnit(UnifyingAstVisitor.java:123)     at com.google.dart.engine.ast.CompilationUnit.accept(CompilationUnit.java:110)     at com.google.dart.engine.internal.resolver.LibraryResolver.buildTypeHierarchies(LibraryResolver.java:597)     at com.google.dart.engine.internal.resolver.LibraryResolver.resolveLibrary(LibraryResolver.java:301)     at com.google.dart.engine.internal.task.ResolveDartLibraryTask.internalPerform(ResolveDartLibraryTask.java:97)     at com.google.dart.engine.internal.task.AnalysisTask.safelyPerform(AnalysisTask.java:119)     ... 26 more


Added this to the 1.6 milestone. Removed Priority-Medium, Oldschool-Milestone-Later labels. Added Priority-High label.

sethladd commented 10 years ago

Marked as High, assigning owner. If I get this wrong, please help me by:

* assigning a new owner


Set owner to @bwilkerson.

bwilkerson commented 10 years ago

Removed this from the 1.6 milestone. Added this to the 1.7 milestone.

bwilkerson commented 10 years ago

Added Started label.

bwilkerson commented 10 years ago

https://codereview.chromium.org/594843006/ (bleeding edge revision 40693)


Added Fixed label.