support the latest version of pkg/analyzer (#625)
* support the latest version of pkg/analyzer
* Unskip the tests that work now outside of the repo (yay!).
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e3e9f39..9e97e3a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 1.0.5
+
+* Support the latest version of `pkg/analyzer`.
+
# 1.0.4
* Ensure formatter throws an exception instead of introducing non-whitespace
diff --git a/bin/format.dart b/bin/format.dart
index 28dab2a..3899305 100644
--- a/bin/format.dart
+++ b/bin/format.dart
@@ -14,7 +14,7 @@
import 'package:dart_style/src/source_code.dart';
// Note: The following line of code is modified by tool/grind.dart.
-const version = "1.0.4";
+const version = "1.0.5";
void main(List<String> args) {
var parser = new ArgParser(allowTrailingOptions: true);
diff --git a/lib/src/source_visitor.dart b/lib/src/source_visitor.dart
index 0da685e..5023663 100644
--- a/lib/src/source_visitor.dart
+++ b/lib/src/source_visitor.dart
@@ -1198,14 +1198,14 @@
visitGenericTypeAlias(GenericTypeAlias node) {
visitNodes(node.metadata, between: newline, after: newline);
_simpleStatement(node, () {
+ token(node.typedefKeyword);
+ space();
+
// If the typedef's type parameters split, split after the "=" too,
// mainly to ensure the function's type parameters and parameters get
// end up on successive lines with the same indentation.
builder.startRule();
- token(node.typedefKeyword);
- space();
-
visit(node.name);
visit(node.typeParameters);
diff --git a/pubspec.lock b/pubspec.lock
index 5ff28ee..e42179e 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -6,7 +6,7 @@
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
- version: "0.29.9"
+ version: "0.30.0"
ansicolor:
description:
name: ansicolor
@@ -30,7 +30,7 @@
name: barback
url: "https://pub.dartlang.org"
source: hosted
- version: "0.15.2+9"
+ version: "0.15.2+11"
boolean_selector:
description:
name: boolean_selector
@@ -60,7 +60,7 @@
name: collection
url: "https://pub.dartlang.org"
source: hosted
- version: "1.13.0"
+ version: "1.14.0"
convert:
description:
name: convert
@@ -78,7 +78,13 @@
name: csslib
url: "https://pub.dartlang.org"
source: hosted
- version: "0.13.4"
+ version: "0.13.5"
+ front_end:
+ description:
+ name: front_end
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.1.0-alpha.4"
glob:
description:
name: glob
@@ -102,7 +108,7 @@
name: http
url: "https://pub.dartlang.org"
source: hosted
- version: "0.11.3+12"
+ version: "0.11.3+13"
http_multi_server:
description:
name: http_multi_server
@@ -127,6 +133,12 @@
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.1"
+ kernel:
+ description:
+ name: kernel
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.3.0-alpha.1"
logging:
description:
name: logging
@@ -144,7 +156,7 @@
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.4"
+ version: "1.0.5"
mime:
description:
name: mime
@@ -240,7 +252,7 @@
name: source_maps
url: "https://pub.dartlang.org"
source: hosted
- version: "0.10.3"
+ version: "0.10.4"
source_span:
description:
name: source_span
@@ -282,7 +294,7 @@
name: test
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.20+3"
+ version: "0.12.20+12"
typed_data:
description:
name: typed_data
diff --git a/pubspec.yaml b/pubspec.yaml
index ef5155b..4f212f0 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,13 +1,13 @@
name: dart_style
# Note: See tool/grind.dart for how to bump the version.
-version: 1.0.4
+version: 1.0.5
author: Dart Team <misc@dartlang.org>
description: Opinionated, automatic Dart source code formatter.
homepage: https://github.com/dart-lang/dart_style
environment:
sdk: ">=1.8.0 <2.0.0"
dependencies:
- analyzer: '^0.29.9'
+ analyzer: '^0.30.0'
args: '>=0.12.1 <0.14.0'
path: '>=1.0.0 <2.0.0'
source_span: '>=1.1.1 <2.0.0'
diff --git a/test/regression/0600/0616.unit b/test/regression/0600/0616.unit
index 720a71e..2331b53 100644
--- a/test/regression/0600/0616.unit
+++ b/test/regression/0600/0616.unit
@@ -1,4 +1,4 @@
->>> (skip: published version of analyzer doesn't support function types yet)
+>>>
import "package:expect/expect.dart";
int Function() x = () => 42;
int Function(int Function()) y = (int Function() x) => x();
diff --git a/test/regression/0600/0619.unit b/test/regression/0600/0619.unit
index 09a7a37..baac3bf 100644
--- a/test/regression/0600/0619.unit
+++ b/test/regression/0600/0619.unit
@@ -1,4 +1,4 @@
->>> (skip: published version of analyzer doesn't support function types yet)
+>>>
typedef F<T> = void Function(T);
<<<
typedef F<T> = void Function(T);
\ No newline at end of file
diff --git a/test/splitting/members.unit b/test/splitting/members.unit
index ebca8c5..ecde98f 100644
--- a/test/splitting/members.unit
+++ b/test/splitting/members.unit
@@ -26,7 +26,7 @@
VeryLongTypeAnnotation
set veryLongSetter(v) {}
}
->>> do not split after "covariant" in field (at least for now) (skip: published version of analyzer doesn't support 'covariant yet')
+>>> do not split after "covariant" in field (at least for now)
class Foo {
covariant var soMuchSoVeryLongFieldNameHere;
covariant VeryLongTypeAnnotation field;
diff --git a/test/splitting/parameters.unit b/test/splitting/parameters.unit
index ccf01fd..c41e857 100644
--- a/test/splitting/parameters.unit
+++ b/test/splitting/parameters.unit
@@ -14,7 +14,7 @@
method(int firstArgument,
int argumentTwo) =>
"very long body that must wrap";
->>> split before "covariant" (skip: published version of analyzer doesn't support 'covariant yet')
+>>> split before "covariant"
class A {
longMethod(covariant parameterNameHere) {}
}
@@ -23,7 +23,7 @@
longMethod(
covariant parameterNameHere) {}
}
->>> split before "covariant" with multiple parameters (skip: published version of analyzer doesn't support 'covariant yet')
+>>> split before "covariant" with multiple parameters
class A {
longMethod(covariant first, second, covariant int third(parameter), fourth) {}
}
@@ -35,14 +35,15 @@
covariant int third(parameter),
fourth) {}
}
->>> never split after "covariant" (at least for now) (skip: published version of analyzer doesn't support 'covariant yet')
+>>> never split after "covariant" (at least for now)
class A {
longMethod(covariant int veryLongParameterNameWow) {}
}
<<<
class A {
longMethod(
- covariant int veryLongParameterNameWow) {}
+ covariant int
+ veryLongParameterNameWow) {}
}
>>> split between field type and name
class Foo {
diff --git a/test/splitting/typedef.unit b/test/splitting/typedef.unit
index 3d09123..aa0760f 100644
--- a/test/splitting/typedef.unit
+++ b/test/splitting/typedef.unit
@@ -1,10 +1,10 @@
40 columns |
->>> split type parameters (skip: published version of analyzer doesn't support function types yet)
+>>> split type parameters
typedef G = T Function<TypeOne, TypeTwo, TypeThree>();
<<<
typedef G = T Function<TypeOne, TypeTwo,
TypeThree>();
->>> split all type parameters (skip: published version of analyzer doesn't support function types yet)
+>>> split all type parameters
typedef G = T Function<TypeOne, TypeTwo, TypeThree, TypeFour, TypeFive, TypeSix>();
<<<
typedef G = T Function<
@@ -14,17 +14,17 @@
TypeFour,
TypeFive,
TypeSix>();
->>> split type and value parameters (skip: published version of analyzer doesn't support function types yet)
+>>> split type and value parameters
typedef G = T Function<TypeOne, TypeTwo, TypeThree>(TypeOne one, TypeTwo two, TypeThree three);
<<<
typedef G = T Function<TypeOne, TypeTwo,
TypeThree>(TypeOne one,
TypeTwo two, TypeThree three);
->>> generic typedef parameters on one line (skip: published version of analyzer doesn't support function types yet)
+>>> generic typedef parameters on one line
typedef Foo<T, S> = Function();
<<<
typedef Foo<T, S> = Function();
->>> generic typedef parameters that split (skip: published version of analyzer doesn't support function types yet)
+>>> generic typedef parameters that split
typedef LongfunctionType<First, Second, Third, Fourth, Fifth, Sixth> = Function(First first, Second second, Third third, Fourth fourth);
<<<
typedef LongfunctionType<First, Second,
@@ -34,7 +34,7 @@
Second second,
Third third,
Fourth fourth);
->>> both type parameter lists split (skip: published version of analyzer doesn't support function types yet)
+>>> both type parameter lists split
typedef LongfunctionType<First, Second, Third, Fourth, Fifth, Sixth> = Function<Seventh>(First first, Second second, Third third, Fourth fourth);
<<<
typedef LongfunctionType<First, Second,
@@ -44,7 +44,7 @@
Second second,
Third third,
Fourth fourth);
->>> all three parameter lists split (skip: published version of analyzer doesn't support function types yet)
+>>> all three parameter lists split
typedef LongfunctionType<First, Second, Third, Fourth, Fifth, Sixth> = Function<Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth, Thirteenth>(First first, Second second, Third third, Fourth fourth);
<<<
typedef LongfunctionType<First, Second,
diff --git a/test/whitespace/classes.unit b/test/whitespace/classes.unit
index 3e088fa..968e422 100644
--- a/test/whitespace/classes.unit
+++ b/test/whitespace/classes.unit
@@ -100,7 +100,7 @@
set g(value) => null;
var h = 1;
}
->>> covariant field (skip: published version of analyzer doesn't support 'covariant yet')
+>>>
class Foo {
covariant var bar;
covariant int baz;
diff --git a/test/whitespace/metadata.unit b/test/whitespace/metadata.unit
index ce92c11..ac0525c 100644
--- a/test/whitespace/metadata.unit
+++ b/test/whitespace/metadata.unit
@@ -254,7 +254,7 @@
@Annotation
@VeryLongMetadataAnnotation
covariant longParameter) {}
->>> metadata on function typedef (skip: published version of analyzer doesn't support function types yet)
+>>> metadata on function typedef
@foo typedef Fn = Function();
<<<
@foo
diff --git a/test/whitespace/methods.unit b/test/whitespace/methods.unit
index 35c09ca..5573794 100644
--- a/test/whitespace/methods.unit
+++ b/test/whitespace/methods.unit
@@ -35,7 +35,7 @@
return file;
}
}
->>> covariant (skip: published version of analyzer doesn't support 'covariant yet')
+>>> covariant
class A {
pos( covariant int a,covariant b );
opt([ covariant int a,covariant b ]);
@@ -49,7 +49,7 @@
named({covariant int a, covariant b});
fn(covariant int f(bool b));
}
->>> covariant in initializing formal (not valid, but dartfmt should accept) (skip: published version of analyzer doesn't support 'covariant yet')
+>>> covariant in initializing formal (not valid, but dartfmt should accept)
class A {
A( covariant this.foo);
}
diff --git a/test/whitespace/typedef.unit b/test/whitespace/typedef.unit
index 40f982d..71d697c 100644
--- a/test/whitespace/typedef.unit
+++ b/test/whitespace/typedef.unit
@@ -3,21 +3,21 @@
typedef Foo < T ,S >(T t,S s);
<<<
typedef Foo<T, S>(T t, S s);
->>> non-generic in typedef (skip: published version of analyzer doesn't support function types yet)
+>>> non-generic in typedef
typedef SomeFunc=ReturnType Function(int param, double other);
<<<
typedef SomeFunc = ReturnType Function(
int param, double other);
->>> generic in typedef (skip: published version of analyzer doesn't support function types yet)
+>>> generic in typedef
typedef Generic = T Function<T>(T param, double other);
<<<
typedef Generic = T Function<T>(
T param, double other);
->>> no return type (skip: published version of analyzer doesn't support function types yet)
+>>> no return type
typedef SomeFunc = Function();
<<<
typedef SomeFunc = Function();
->>> nested (skip: published version of analyzer doesn't support function types yet)
+>>> nested
typedef SomeFunc = Function(int first, Function(int first, bool second, String third) second, String third);
<<<
typedef SomeFunc = Function(
@@ -26,15 +26,15 @@
String third)
second,
String third);
->>> without param names (skip: published version of analyzer doesn't support function types yet)
+>>> without param names
typedef F = Function(int, bool, String);
<<<
typedef F = Function(int, bool, String);
->>> generic (skip: published version of analyzer doesn't support function types yet)
+>>> generic
typedef Foo < A ,B>=Function ( A a, B b );
<<<
typedef Foo<A, B> = Function(A a, B b);
->>> generic function (skip: published version of analyzer doesn't support function types yet)
+>>> generic function
typedef Foo =Function < A ,B > ( A a,B b );
<<<
typedef Foo = Function<A, B>(A a, B b);
\ No newline at end of file