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

Fix PseudoType #1815

Merged
merged 4 commits into from
Jan 2, 2025
Merged
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

### Fixed
* For the Android platform, changed compileSdkVersion into 31 from 28 to fix the fatal `android:attr/lStar not found` error when using Flutter 3.24.
* Fix breakage of `PseudoType` after Flutter 3.27.1. (Issue [#1813](https://github.com/realm/realm-dart/issues/1813))

### Compatibility
* Realm Studio: 15.0.0 or later.
Expand Down
4 changes: 4 additions & 0 deletions packages/CHANGELOG.ejson.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.1

- Avoid name conflict on `LinkCode`.

## 0.4.0

- `fromEJson<T>` now accepts a `defaultValue` argument that is returned if
Expand Down
4 changes: 2 additions & 2 deletions packages/ejson_lint/lib/src/lints/mismatched_getter_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/error.dart' as error;
import 'package:analyzer/error/listener.dart';
import 'package:custom_lint_builder/custom_lint_builder.dart';
import 'package:ejson_analyzer/ejson_analyzer.dart';
Expand All @@ -13,7 +13,7 @@ class MismatchedGetterType extends DartLintRule {
code: const LintCode(
name: 'mismatched_getter_type',
problemMessage: 'Type of getter does not match type of constructor parameter',
errorSeverity: ErrorSeverity.ERROR,
errorSeverity: error.ErrorSeverity.ERROR,
),
);

Expand Down
4 changes: 2 additions & 2 deletions packages/ejson_lint/lib/src/lints/missing_getter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/error.dart' as error;
import 'package:analyzer/error/listener.dart';
import 'package:custom_lint_builder/custom_lint_builder.dart';
import 'package:ejson_analyzer/ejson_analyzer.dart';
Expand All @@ -13,7 +13,7 @@ class MissingGetter extends DartLintRule {
code: const LintCode(
name: 'missing_getter',
problemMessage: 'Missing getter for constructor parameter',
errorSeverity: ErrorSeverity.ERROR,
errorSeverity: error.ErrorSeverity.ERROR,
),
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2024 MongoDB, Inc.
// SPDX-License-Identifier: Apache-2.0

import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/error.dart' as error;
import 'package:analyzer/error/listener.dart';
import 'package:custom_lint_builder/custom_lint_builder.dart';
import 'package:ejson_analyzer/ejson_analyzer.dart';
Expand All @@ -21,7 +21,7 @@ class TooManyAnnotatedConstructors extends DartLintRule {
code: const LintCode(
name: 'too_many_annotated_constructors',
problemMessage: 'Only one constructor can be annotated',
errorSeverity: ErrorSeverity.ERROR,
errorSeverity: error.ErrorSeverity.ERROR,
),
);

Expand Down
55 changes: 25 additions & 30 deletions packages/realm_dart/lib/src/cli/metrics/metrics.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import 'package:source_span/source_span.dart';

class ExpandedContextSpan with SourceSpanMixin implements FileSpan {
class ExpandedContextSpan extends SourceSpanMixin implements FileSpan {
final FileSpan _span, _contextSpan;

ExpandedContextSpan(this._span, Iterable<FileSpan> contextSpans) : _contextSpan = contextSpans.fold<FileSpan>(_span, (acc, c) => acc.expand(c));
Expand Down
14 changes: 3 additions & 11 deletions packages/realm_generator/lib/src/pseudo_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@ class PseudoType extends TypeImpl {

PseudoType(this._name, {this.nullabilitySuffix = NullabilitySuffix.none});

Never get _never => throw UnimplementedError();

@override
R accept<R>(TypeVisitor<R> visitor) => _never;

@override
R acceptWithArgument<R, A>(TypeVisitorWithArgument<R, A> visitor, A argument) => _never;
R acceptWithArgument<R, A>(TypeVisitorWithArgument<R, A> visitor, A argument) => throw UnimplementedError();

@override
void appendTo(ElementDisplayStringBuilder builder) {
Expand All @@ -46,17 +41,14 @@ class PseudoType extends TypeImpl {
im.invoke(writeNullability, <dynamic>[nullabilitySuffix]); // #_writeNullability won't work
}

@override
String? get name => _never;

@override
PseudoType withNullability(NullabilitySuffix nullabilitySuffix) {
return PseudoType(_name, nullabilitySuffix: nullabilitySuffix);
}

@override
Element? get element2 => _never;
Element? get element => null;

@override
Element? get element => null;
Never noSuchMethod(Invocation invocation) => throw UnimplementedError();
}