dart-lang / build

A build system for Dart written in Dart
https://pub.dev/packages/build
BSD 3-Clause "New" or "Revised" License
792 stars 207 forks source link

type 'DynamicTypeImpl' is not a subtype of type 'InterfaceType' #2493

Closed andreskiu closed 5 years ago

andreskiu commented 5 years ago

Hello, i don't know what the problem is. A few days later, the plugin was working fine but i cannot make it work again. I originally detected the bug with the next versions packages:

json_serializable: ^3.0.0, json_annotation: ^2.4.0 build_runner: ^1.0.0

However, i've update this packages to the next versions and the bug still remains:

json_serializable: ^3.2.3 json_annotation: ^3.0.0 build_runner: ^1.6.4

i've attach one model file (the newest), just in case.... All my models are similar and were working fine until something happened. Is a dart file, please remove the .txt extension ( github doesn't support .dart extension on attached files).

I get the following log with just running "flutter pub run build_runner build":

Please file an issue with reproduction steps at https://github.com/dart-lang/build/issues

type 'DynamicTypeImpl' is not a subtype of type 'InterfaceType' package:analyzer/src/summary/link.dart 5568:5 TypeProviderForLink._buildInterfaceType package:analyzer/src/summary/link.dart 5533:23 TypeProviderForLink.objectType package:analyzer/src/summary/link.dart 926:67 ClassElementForLink_Class._computeInterfaceType package:analyzer/src/summary/link.dart 824:27 ClassElementForLink_Class.supertype package:analyzer/src/task/strong_mode.dart 303:33 InstanceMemberInferrer._inferClass package:analyzer/src/task/strong_mode.dart 335:9 InstanceMemberInferrer._inferClasses package:analyzer/src/task/strong_mode.dart 56:5 InstanceMemberInferrer.inferCompilationUnit package:analyzer/src/summary/link.dart 1640:7 CompilationUnitElementInBuildUnit.link package:analyzer/src/summary/link.dart 3870:12 LibraryElementInBuildUnit.link package:analyzer/src/summary/link.dart 3570:15 LibraryCycleNode.link package:analyzer/src/summary/link.dart 3510:7 LibraryCycleDependencyWalker.evaluate package:analyzer/src/summary/link.dart 2226:13 DependencyWalker.walk.strongConnect package:analyzer/src/summary/link.dart 2192:24 DependencyWalker.walk.strongConnect package:analyzer/src/summary/link.dart 2192:24 DependencyWalker.walk.strongConnect package:analyzer/src/summary/link.dart 2192:24 DependencyWalker.walk.strongConnect package:analyzer/src/summary/link.dart 2192:24 DependencyWalker.walk.strongConnect package:analyzer/src/summary/link.dart 2245:18 DependencyWalker.walk package:analyzer/src/summary/link.dart 3543:42 LibraryCycleForLink.ensureLinked package:analyzer/src/summary/link.dart 4075:35 Linker.link package:analyzer/src/summary/link.dart 312:74 _relink package:analyzer/src/summary/link.dart 126:3 link package:analyzer/src/dart/analysis/library_context.dart 220:25 LibraryContext.load. package:analyzer/src/dart/analysis/performance_logger.dart 34:15 PerformanceLog.run package:analyzer/src/dart/analysis/library_context.dart 219:12 LibraryContext.load package:analyzer/src/dart/analysis/library_context.dart 98:7 new LibraryContext package:analyzer/src/dart/analysis/driver.dart 1429:29 AnalysisDriver._createLibraryContext package:analyzer/src/dart/analysis/driver.dart 997:34 AnalysisDriver.performWork package:analyzer/src/dart/analysis/driver.dart 1921:24 AnalysisDriverScheduler._run package:analyzer/src/dart/analysis/driver.dart 1855:5 AnalysisDriverScheduler.start package:build_resolvers/src/analysis_driver.dart 54:13 analysisDriver package:build_resolvers/src/resolver.dart 138:18 new AnalyzerResolvers package:build_runner_core/src/generate/options.dart 192:19 BuildOptions.create package:build_runner/src/generate/build.dart 85:36 build package:build_runner/src/entrypoint/build.dart 28:24 BuildCommand.run package:args/command_runner.dart 197:27 CommandRunner.runCommand package:args/command_runner.dart 112:25 CommandRunner.run. dart:async new Future.sync package:args/command_runner.dart 112:14 CommandRunner.run package:build_runner/src/entrypoint/run.dart 24:31 run .dart_tool\build\entrypoint\build.dart 22:22 main

===================================================

flutter doctor: [√] Flutter (Channel master, v1.10.15-pre.23, on Microsoft Windows [Versión 10.0.18362.388], locale es-AR) [√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [!] Android Studio (version 3.5) X Flutter plugin not installed; this adds Flutter specific functionality. [!] IntelliJ IDEA Community Edition (version 2018.1) X Flutter plugin not installed; this adds Flutter specific functionality. X Dart plugin not installed; this adds Dart specific functionality. [√] VS Code, 64-bit edition (version 1.38.1) [√] Connected device (1 available)

===================================================

flutter --version

Flutter 1.10.15-pre.23 • channel master • https://github.com/flutter/flutter.git Framework • revision 440753bae8 (10 hours ago) • 2019-10-08 21:33:17 -0700 Engine • revision 0d749933bc Tools • Dart 2.6.0 (build 2.6.0-dev.6.0 f4a72bfc64)

===================================================

pubspec.yaml

dependencies: flutter: sdk: flutter

firebase_core: "^0.4.0+1" cloud_firestore: ^0.12.9+4 firebase_messaging: ^5.1.4 firebase_auth: "^0.14.0+2" firebase_storage: ^3.0.0 google_sign_in: ^4.0.0 flutter_facebook_login: "^2.0.0" badges: ^0.0.6 intl: ^0.15.7 validate: ^1.7.0 datetime_picker_formfield: ^0.4.3 flutter_datetime_picker: ^1.2.6 modal_progress_hud: ^0.1.2 image_picker: ^0.5.0 image_cropper: ^1.0.1 http: ^0.12.0+2 contacts_service: ^0.2.9 shared_preferences: ^0.5.3+4 mvc_pattern: ^3.3.6 bloc_pattern: ^2.2.1 rxdart: ^0.22.3 json_annotation: ^3.0.0 cached_network_image: ^1.1.1 permission_handler: ^3.2.0 flutter_country_picker: ^0.1.4 flutter_cupertino_date_picker: ^1.0.12 # esto nos da el reloj de cupertino - buscar update

cupertino_icons: ^0.1.2

dev_dependencies: flutter_test: sdk: flutter

build_runner: ^1.6.4 json_serializable: ^3.2.3

jakemac53 commented 5 years ago

@andreskiu what is your version of build_resolvers (you can find it in your pubspec.lock)? I believe that updating that to the latest (using a flutter packages pub upgrade) will fix the issue.

andreskiu commented 5 years ago

@andreskiu what is your version of build_resolvers (you can find it in your pubspec.lock)? I believe that updating that to the latest (using a flutter packages pub upgrade) will fix the issue.

I don't have build_resolvers in my dependencies. i'll add it and try again

jakemac53 commented 5 years ago

You don't need to add it to your deps - its a transitive dependency of build_runner. A normal pub upgrade should get you the latest.

andreskiu commented 5 years ago

Thanks you a lot for the quick response! It works! Sorry for my silly mistake

jakemac53 commented 5 years ago

No worries, this was a legitimate bug and you aren't the only one who got confused :)

ryanheise commented 5 years ago

In my case flutter upgrade didn't do anything since I was already on the latest flutter, but removing pubspec.lock and then running flutter pub get did the trick.

jakemac53 commented 5 years ago

@ryanheise flutter pub upgrade is different from flutter upgrade - the former is for your package dependencies and the latter is the flutter sdk itself. In this case you need to update your package dependencies. Deleting your pubspec.lock and re-running flutter pub get is effectively the same thing as doing a flutter pub upgrade though.

ryanheise commented 5 years ago

Ah, I see. thanks for clearing that up!