Skip to content

Commit 38d6fee

Browse files
committed
Remove work-around for analyzer issue that is now fixed
Related to dart-lang/sdk#29767
1 parent 4219ddd commit 38d6fee

File tree

2 files changed

+4
-26
lines changed

2 files changed

+4
-26
lines changed

lib/src/type_checker.dart

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ abstract class TypeChecker {
125125

126126
/// Returns `true` if the type of [element] can be assigned to this type.
127127
bool isAssignableFrom(Element element) =>
128-
isExactly(element) || _getAllSupertypes(element).any(isExactlyType);
128+
isExactly(element) ||
129+
(element is ClassElement && element.allSupertypes.any(isExactlyType));
129130

130131
/// Returns `true` if [staticType] can be assigned to this type.
131132
bool isAssignableFromType(DartType staticType) =>
@@ -164,29 +165,6 @@ abstract class TypeChecker {
164165
bool isSuperTypeOf(DartType staticType) => isSuperOf(staticType.element);
165166
}
166167

167-
// TODO(kevmoo) Remove when bug with `ClassElement.allSupertypes` is fixed
168-
// https://github.com/dart-lang/sdk/issues/29767
169-
Iterable<InterfaceType> _getAllSupertypes(Element element) sync* {
170-
if (element is ClassElement) {
171-
var processed = new Set<InterfaceType>();
172-
var toExplore = new List<InterfaceType>.from(element.allSupertypes);
173-
174-
while (toExplore.isNotEmpty) {
175-
var item = toExplore.removeLast();
176-
177-
if (processed.add(item)) {
178-
yield item;
179-
180-
// Now drill into nested superTypes - but make sure not to duplicate
181-
// any of them.
182-
toExplore.addAll(item.element.allSupertypes.where((e) {
183-
return !toExplore.contains(e) && !processed.contains(e);
184-
}));
185-
}
186-
}
187-
}
188-
}
189-
190168
// Checks a static type against another static type;
191169
class _LibraryTypeChecker extends TypeChecker {
192170
final DartType _type;

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: source_gen
2-
version: 0.7.5+1
2+
version: 0.7.6-dev
33
author: Dart Team <[email protected]>
44
description: Automated source code generation for Dart.
55
homepage: https://github.com/dart-lang/source_gen
66
environment:
77
sdk: '>=2.0.0-dev.19.0 <2.0.0'
88
dependencies:
9-
analyzer: '>=0.29.10 <0.32.0'
9+
analyzer: ^0.31.0
1010
build: '>=0.10.0 <0.13.0'
1111
dart_style: '>=0.1.7 <2.0.0'
1212
meta: ^1.1.0

0 commit comments

Comments
 (0)