Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump deps on analyzer and dart_style #1445

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions json_serializable/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 6.9.0-wip

- Use conditional map syntax to clean up `null` handling in `toJson` functions.
- Require `analyzer: ^6.9.0`
- Require Dart 3.5

## 6.8.0
Expand Down
12 changes: 6 additions & 6 deletions json_serializable/lib/src/field_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ class _FieldSet implements Comparable<_FieldSet> {

static int _sortByLocation(FieldElement a, FieldElement b) {
final checkerA = TypeChecker.fromStatic(
(a.enclosingElement as InterfaceElement).thisType,
(a.enclosingElement3 as InterfaceElement).thisType,
);

if (!checkerA.isExactly(b.enclosingElement)) {
if (!checkerA.isExactly(b.enclosingElement3)) {
// in this case, you want to prioritize the enclosingElement that is more
// "super".

if (checkerA.isAssignableFrom(b.enclosingElement)) {
if (checkerA.isAssignableFrom(b.enclosingElement3)) {
return -1;
}

final checkerB = TypeChecker.fromStatic(
(b.enclosingElement as InterfaceElement).thisType);
(b.enclosingElement3 as InterfaceElement).thisType);

if (checkerB.isAssignableFrom(a.enclosingElement)) {
if (checkerB.isAssignableFrom(a.enclosingElement3)) {
return 1;
}
}
Expand Down Expand Up @@ -83,7 +83,7 @@ List<FieldElement> createSortedFieldSet(ClassElement element) {

for (final v in manager.getInheritedConcreteMap2(element).values) {
assert(v is! FieldElement);
if (_dartCoreObjectChecker.isExactly(v.enclosingElement)) {
if (_dartCoreObjectChecker.isExactly(v.enclosingElement3)) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ _JsonConvertData? _typeConverterFrom(

final annotationElement = match.elementAnnotation?.element;
if (annotationElement is PropertyAccessorElement) {
final enclosing = annotationElement.enclosingElement;
final enclosing = annotationElement.enclosingElement3;

var accessString = annotationElement.name;

Expand Down
6 changes: 3 additions & 3 deletions json_serializable/lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,15 @@ extension ExecutableElementExtension on ExecutableElement {
}

if (this is MethodElement) {
return '${enclosingElement.name}.$name';
return '${enclosingElement3.name}.$name';
}

if (this is ConstructorElement) {
// Ignore the default constructor.
if (name.isEmpty) {
return '${enclosingElement.name}';
return '${enclosingElement3.name}';
}
return '${enclosingElement.name}.$name';
return '${enclosingElement3.name}.$name';
}

throw UnsupportedError(
Expand Down
4 changes: 2 additions & 2 deletions json_serializable/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ topics:
resolution: workspace

dependencies:
analyzer: ^6.5.0
analyzer: ^6.9.0
async: ^2.10.0
build: ^2.4.1
build_config: ^1.1.0
Expand All @@ -36,7 +36,7 @@ dev_dependencies:
path: ../shared_test
build_runner: ^2.4.6
build_verify: ^3.0.0
dart_style: ^2.3.2
dart_style: ^2.3.7
logging: ^1.0.0
source_gen_test: ^1.0.6
test: ^1.24.4
Expand Down
3 changes: 2 additions & 1 deletion json_serializable/tool/shared.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import 'package:build/build.dart';
import 'package:dart_style/dart_style.dart';
import 'package:yaml/yaml.dart';

final formatter = DartFormatter();
final formatter =
DartFormatter(languageVersion: DartFormatter.latestLanguageVersion);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized this is pointless, since latestLanguageVersion is the default. 🤷 🤦

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also really don't want to do it this way. I am prepping a change to source_gen which is going to be breaking, and will give you a language version to use in the format function.


// Until we have verification in pkg:build and friends
// https://github.com/dart-lang/build/issues/590
Expand Down
Loading