From ed99299415c34fc9a404604ee2562213f9ad9428 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Sun, 18 Oct 2026 14:52:43 -0600 Subject: [PATCH] increased snapshot coverage --- lib/src/symbol_generator.dart | 9 +- snapshots/input/basic-project/lib/async.dart | 66 ++++ .../input/basic-project/lib/classes.dart | 111 ++++++ .../input/basic-project/lib/extensions.dart | 29 ++ .../input/basic-project/lib/generics.dart | 49 +++ .../input/basic-project/lib/operators.dart | 69 ++++ .../dart3-features/lib/class_modifiers.dart | 51 +++ .../input/dart3-features/lib/modern.dart | 62 ++++ .../input/dart3-features/lib/patterns.dart | 70 ++++ snapshots/input/dart3-features/pubspec.lock | 2 +- snapshots/input/dart3-features/pubspec.yaml | 2 +- snapshots/output/basic-project/lib/async.dart | 146 ++++++++ .../output/basic-project/lib/classes.dart | 329 ++++++++++++++++++ .../output/basic-project/lib/extensions.dart | 72 ++++ .../output/basic-project/lib/generics.dart | 178 ++++++++++ .../output/basic-project/lib/operators.dart | 217 ++++++++++++ .../dart3-features/lib/class_modifiers.dart | 123 +++++++ .../output/dart3-features/lib/modern.dart | 170 +++++++++ .../output/dart3-features/lib/patterns.dart | 162 +++++++++ snapshots/output/dart3-features/pubspec.yaml | 2 +- 20 files changed, 1915 insertions(+), 4 deletions(-) create mode 100644 snapshots/input/basic-project/lib/async.dart create mode 100644 snapshots/input/basic-project/lib/classes.dart create mode 100644 snapshots/input/basic-project/lib/extensions.dart create mode 100644 snapshots/input/basic-project/lib/generics.dart create mode 100644 snapshots/input/basic-project/lib/operators.dart create mode 100644 snapshots/input/dart3-features/lib/class_modifiers.dart create mode 100644 snapshots/input/dart3-features/lib/modern.dart create mode 100644 snapshots/input/dart3-features/lib/patterns.dart create mode 100755 snapshots/output/basic-project/lib/async.dart create mode 100755 snapshots/output/basic-project/lib/classes.dart create mode 100755 snapshots/output/basic-project/lib/extensions.dart create mode 100755 snapshots/output/basic-project/lib/generics.dart create mode 100755 snapshots/output/basic-project/lib/operators.dart create mode 100755 snapshots/output/dart3-features/lib/class_modifiers.dart create mode 100755 snapshots/output/dart3-features/lib/modern.dart create mode 100755 snapshots/output/dart3-features/lib/patterns.dart diff --git a/lib/src/symbol_generator.dart b/lib/src/symbol_generator.dart index fe9784d9..2ae69bd8 100644 --- a/lib/src/symbol_generator.dart +++ b/lib/src/symbol_generator.dart @@ -260,7 +260,7 @@ class SymbolGenerator { if (element is MethodElement) { final className = element.enclosingElement?.name; - return '$namespace/$className#${element.name}().'; + return '$namespace/$className#${_escapeIdentifier(element.name!)}().'; } if (element is TopLevelFunctionElement || element is LocalFunctionElement) { @@ -334,6 +334,13 @@ class SymbolGenerator { return _localElementRegistry[ele]!; } + /// Wraps [name] in backticks if it contains characters not allowed in a + /// scip simple-identifier (ex: operator methods like `==` or `[]`) + String _escapeIdentifier(String name) { + if (RegExp(r'^[\w+\-$]+$').hasMatch(name)) return name; + return '`${name.replaceAll('`', '``')}`'; + } + String _escapeNamespacePath(String path) { return path .split('/') diff --git a/snapshots/input/basic-project/lib/async.dart b/snapshots/input/basic-project/lib/async.dart new file mode 100644 index 00000000..03c1a4eb --- /dev/null +++ b/snapshots/input/basic-project/lib/async.dart @@ -0,0 +1,66 @@ +import 'dart:async'; + +Future fetchValue() async { + await Future.delayed(Duration.zero); + return 42; +} + +Stream countTo(int n) async* { + for (var i = 1; i <= n; i++) { + yield i; + } +} + +Iterable evens(int max) sync* { + for (var i = 0; i < max; i += 2) { + yield i; + } + yield* [max]; +} + +class CustomException implements Exception { + final String message; + CustomException(this.message); +} + +Future main() async { + final value = await fetchValue(); + + await for (final i in countTo(value)) { + print(i); + } + + final controller = StreamController(); + final subscription = controller.stream.listen(print); + controller.add('event'); + await subscription.cancel(); + + try { + throw CustomException('boom'); + } on CustomException catch (e, stackTrace) { + print('${e.message} $stackTrace'); + } on FormatException { + rethrow; + } catch (e) { + print(e); + } finally { + print('done'); + } + + outer: + for (final i in evens(10)) { + var j = 0; + while (true) { + if (j > i) continue outer; + if (i > 6) break outer; + j++; + } + } + + var k = 0; + do { + k++; + } while (k < 3); + + assert(k == 3, 'k should be 3'); +} diff --git a/snapshots/input/basic-project/lib/classes.dart b/snapshots/input/basic-project/lib/classes.dart new file mode 100644 index 00000000..6d2ce7c7 --- /dev/null +++ b/snapshots/input/basic-project/lib/classes.dart @@ -0,0 +1,111 @@ +abstract interface class Shape { + double get area; +} + +class Point { + final int x; + final int y; + + const Point(this.x, this.y); + + const Point.origin() : this(0, 0); + + factory Point.fromList(List list) = _ListPoint; + + static int instances = 0; + + static Point parse(String value) { + final parts = value.split(','); + return Point(int.parse(parts[0]), int.parse(parts[1])); + } +} + +class _ListPoint extends Point { + _ListPoint(List list) : super(list[0], list[1]); +} + +class Rectangle implements Shape { + final double width; + final double height; + late final String description = 'Rectangle $width x $height'; + + Rectangle(this.width, this.height) : assert(width >= 0); + + @override + double get area => width * height; +} + +class Square extends Rectangle { + Square(double side) : super(side, side); +} + +class ColoredSquare extends Square { + final String color; + ColoredSquare(super.side, {this.color = 'red'}); +} + +mixin class Walker { + void walk() => print('walking'); +} + +mixin Logger on Rectangle { + void log() => print('area: $area'); +} + +class LoggedRectangle extends Rectangle with Logger, Walker { + LoggedRectangle() : super(1, 2); +} + +enum Planet implements Comparable { + mercury(mass: 3.303e+23, radius: 2.4397e6), + earth(mass: 5.976e+24, radius: 6.37814e6); + + const Planet({required this.mass, required this.radius}); + + final double mass; + final double radius; + + static const gravitationalConstant = 6.67300E-11; + + double get surfaceGravity => gravitationalConstant * mass / (radius * radius); + + @override + int compareTo(Planet other) => mass.compareTo(other.mass); +} + +String greet(String name, [String greeting = 'Hello', int? times]) => + '$greeting $name ${times ?? 1}'; + +void main() { + const origin = Point.origin(); + final fromList = Point.fromList([1, 2]); + Point.instances++; + Point.parse('1,2'); + print([origin, fromList]); + + final square = ColoredSquare(2, color: 'blue'); + print(square.area); + print(square.description); + + LoggedRectangle() + ..log() + ..walk(); + + Planet.earth.surfaceGravity; + Planet.values.byName('mercury'); + Planet.earth.compareTo(Planet.mercury); + Planet.earth.index; + Planet.earth.name; + + greet('Bob'); + greet('Bob', 'Hi', 2); + + // tear-offs + final greetFn = greet; + final parseFn = Point.parse; + final ctorFn = Point.new; + final namedCtorFn = Point.origin; + final methodFn = square.toString; + final listOf = List.filled; + print([greetFn, parseFn, ctorFn, namedCtorFn, methodFn, listOf]); +} diff --git a/snapshots/input/basic-project/lib/extensions.dart b/snapshots/input/basic-project/lib/extensions.dart new file mode 100644 index 00000000..0700a97a --- /dev/null +++ b/snapshots/input/basic-project/lib/extensions.dart @@ -0,0 +1,29 @@ +extension StringExtensions on String { + String get shout => toUpperCase(); + + bool get isBlank => trim().isEmpty; + + String repeat(int times) => List.filled(times, this).join(); + + static String empty() => ''; +} + +extension on List { + T? get secondOrNull => length > 1 ? this[1] : null; +} + +extension NumberParsing on String { + int parseInt() => int.parse(this); +} + +void main() { + 'hello'.shout; + ' '.isBlank; + 'ab'.repeat(3); + StringExtensions.empty(); + [1, 2].secondOrNull; + + // explicit extension application + StringExtensions('hi').repeat(2); + NumberParsing('42').parseInt(); +} diff --git a/snapshots/input/basic-project/lib/generics.dart b/snapshots/input/basic-project/lib/generics.dart new file mode 100644 index 00000000..4eeef539 --- /dev/null +++ b/snapshots/input/basic-project/lib/generics.dart @@ -0,0 +1,49 @@ +class Box { + T value; + Box(this.value); + + R map(R Function(T value) transform) => transform(value); +} + +class NumberBox extends Box { + NumberBox(super.value); + + N add(N other) => (value + other) as N; +} + +abstract class Repository { + V? find(K key); + void save(K key, V value); +} + +class MemoryRepository implements Repository { + final Map _store = {}; + + @override + V? find(String key) => _store[key]; + + @override + void save(String key, V value) => _store[key] = value; +} + +T firstOf(List items) => items.first; + +typedef Mapper = B Function(A input); +typedef StringMap = Map; + +void main() { + final box = Box(1); + final str = box.map((v) => '$v'); + final numBox = NumberBox(2.5); + numBox.add(1.5); + + final repo = MemoryRepository>(); + repo.save('a', box); + repo.find('a'); + + firstOf([str]); + + Mapper mapper = (input) => '$input'; + StringMap map = {'a': 1}; + print([mapper(1), map]); +} diff --git a/snapshots/input/basic-project/lib/operators.dart b/snapshots/input/basic-project/lib/operators.dart new file mode 100644 index 00000000..ca395e99 --- /dev/null +++ b/snapshots/input/basic-project/lib/operators.dart @@ -0,0 +1,69 @@ +class Vector { + final int x; + final int y; + + const Vector(this.x, this.y); + + static const zero = Vector(0, 0); + + Vector operator +(Vector other) => Vector(x + other.x, y + other.y); + Vector operator -() => Vector(-x, -y); + int operator [](int index) => index == 0 ? x : y; + bool operator <(Vector other) => length < other.length; + + int get length => x * x + y * y; + + @override + bool operator ==(Object other) => + other is Vector && other.x == x && other.y == y; + + @override + int get hashCode => Object.hash(x, y); +} + +class Multiplier { + final int factor; + Multiplier(this.factor); + + int call(int value) => value * factor; +} + +Vector? maybeVector() => null; + +int _counter = 0; +int get counter => _counter; +set counter(int value) => _counter = value; + +void main() { + var a = const Vector(1, 2); + var b = Vector.zero; + var c = a + b; + c = -c; + print(c[0]); + print(a < b); + a += b; + + final doubler = Multiplier(2); + doubler(4); + + counter = 5; + counter++; + print(counter); + + Vector? maybe = maybeVector(); + maybe ??= a; + print(maybeVector()?.x ?? 0); + print(maybeVector()!.y); + + final includeExtra = DateTime.now().isUtc; + final list = [ + 1, + ...[2, 3], + ...?null, + if (includeExtra) 4 else 5, + for (var i = 0; i < 3; i++) i * 10, + ]; + final set = {...list}; + final map = {for (final v in set) v: '$v'}; + print(map); +} diff --git a/snapshots/input/dart3-features/lib/class_modifiers.dart b/snapshots/input/dart3-features/lib/class_modifiers.dart new file mode 100644 index 00000000..58fcc0cf --- /dev/null +++ b/snapshots/input/dart3-features/lib/class_modifiers.dart @@ -0,0 +1,51 @@ +abstract interface class Flyer { + void fly(); +} + +abstract base class Vehicle { + void move(); +} + +base mixin Engine { + void start() => print('vroom'); +} + +mixin class Musician { + void play() => print('playing'); +} + +final class Airplane extends Vehicle with Engine implements Flyer { + @override + void move() => start(); + + @override + void fly() => move(); +} + +sealed class Result { + const Result(); +} + +final class Ok extends Result { + final T value; + const Ok(this.value); +} + +final class Err extends Result { + final Object error; + const Err(this.error); +} + +class Band with Musician {} + +String describe(Result result) => switch (result) { + Ok(:final value) => 'ok $value', + Err(:final error) => 'err $error', + }; + +void main() { + Airplane().fly(); + Band().play(); + describe(const Ok(1)); + describe(Err('bad')); +} diff --git a/snapshots/input/dart3-features/lib/modern.dart b/snapshots/input/dart3-features/lib/modern.dart new file mode 100644 index 00000000..f537a56b --- /dev/null +++ b/snapshots/input/dart3-features/lib/modern.dart @@ -0,0 +1,62 @@ +// Extension types (Dart 3.3) +extension type UserId(int id) { + UserId.fromString(String value) : this(int.parse(value)); + + bool get isValid => id > 0; + + UserId next() => UserId(id + 1); +} + +extension type const Meters(double value) implements double { + Meters operator +(Meters other) => Meters(value + other.value); +} + +// Wildcard variables (Dart 3.7) +void wildcards(int _, int _) { + var _ = 1; + final _ = 2; + for (var _ in [1, 2]) {} +} + +// Null-aware elements (Dart 3.8) +List nullAwareElements(String? maybe, Map source) { + final map = {'key': ?source['key']}; + print(map); + return ['always', ?maybe]; +} + +enum Status { active, inactive } + +class Config { + final Status status; + const Config({this.status = .active}); + + static Config get defaults => const Config(); +} + +// Dot shorthands (Dart 3.10) +bool isActive(Status status) => status == .active; + +void main() { + final id = UserId(1); + final parsed = UserId.fromString('2'); + print([id.isValid, parsed.next().id]); + + const length = Meters(1.5); + print(length + Meters(2)); + + wildcards(1, 2); + nullAwareElements(null, {'key': 1}); + + Status status = .inactive; + Config config = .defaults; + print(isActive(status)); + print(config.status); + + switch (status) { + case .active: + print('active'); + case .inactive: + print('inactive'); + } +} diff --git a/snapshots/input/dart3-features/lib/patterns.dart b/snapshots/input/dart3-features/lib/patterns.dart new file mode 100644 index 00000000..0f6a7018 --- /dev/null +++ b/snapshots/input/dart3-features/lib/patterns.dart @@ -0,0 +1,70 @@ +sealed class Shape {} + +class Circle extends Shape { + final double radius; + Circle(this.radius); +} + +class Square extends Shape { + final double side; + Square(this.side); +} + +double area(Shape shape) => switch (shape) { + Circle(radius: final r) => 3.14 * r * r, + Square(:final side) => side * side, + }; + +({String name, int age}) person() => (name: 'Alice', age: 30); + +(int, {String label}) mixed() => (1, label: 'one'); + +void main() { + final p = person(); + print('${p.name} ${p.age}'); + + final m = mixed(); + print('${m.$1} ${m.label}'); + + final (:name, :age) = person(); + print('$name $age'); + + var (a, b) = (1, 2); + (a, b) = (b, a); + + final list = [1, 2, 3, 4]; + switch (list) { + case [final first, ...final rest]: + print('$first $rest'); + case []: + print('empty'); + } + + final Object? value = {'id': 1, 'tags': ['x']}; + if (value case {'id': int id, 'tags': [String tag]}) { + print('$id $tag'); + } + + final int? nullable = 3; + if (nullable case final n?) { + print(n); + } + + final dynamic raw = 3; + if (raw case final int asInt as int) { + print(asInt); + } + + final (int x, int y) = (5, 6); + print(x + y); + + for (final (i, s) in [(1, 'a'), (2, 'b')]) { + print('$i $s'); + } + + for (final Circle(:radius) in [Circle(1), Circle(2)]) { + print(radius); + } + + print(area(Circle(1))); +} diff --git a/snapshots/input/dart3-features/pubspec.lock b/snapshots/input/dart3-features/pubspec.lock index 573410f7..cc66e3bd 100644 --- a/snapshots/input/dart3-features/pubspec.lock +++ b/snapshots/input/dart3-features/pubspec.lock @@ -2,4 +2,4 @@ # See https://dart.dev/tools/pub/glossary#lockfile packages: {} sdks: - dart: ">=3.0.0 <4.0.0" + dart: ">=3.10.0 <4.0.0" diff --git a/snapshots/input/dart3-features/pubspec.yaml b/snapshots/input/dart3-features/pubspec.yaml index c1c43154..5e9f33d0 100644 --- a/snapshots/input/dart3-features/pubspec.yaml +++ b/snapshots/input/dart3-features/pubspec.yaml @@ -3,4 +3,4 @@ version: 1.0.0 publish_to: none environment: - sdk: ">=3.0.0 <4.0.0" \ No newline at end of file + sdk: ">=3.10.0 <4.0.0" \ No newline at end of file diff --git a/snapshots/output/basic-project/lib/async.dart b/snapshots/output/basic-project/lib/async.dart new file mode 100755 index 00000000..0ea3377a --- /dev/null +++ b/snapshots/output/basic-project/lib/async.dart @@ -0,0 +1,146 @@ + import 'dart:async'; +// definition scip-dart pub dart_test 1.0.0 lib/`async.dart`/ +// ^^^^^^^^^^^^ reference scip-dart pub dart:async 3.13.0 dart:async/ + + Future fetchValue() async { +//^^^^^^ reference scip-dart pub dart:async 3.13.0 dart:async/`future.dart`/Future# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`async.dart`/fetchValue(). + await Future.delayed(Duration.zero); +// ^^^^^^ reference scip-dart pub dart:async 3.13.0 dart:async/`future.dart`/Future# +// ^^^^^^^ reference scip-dart pub dart:async 3.13.0 dart:async/`future.dart`/Future#delayed(). +// ^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`duration.dart`/Duration# +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`duration.dart`/Duration#zero. + return 42; + } + + Stream countTo(int n) async* { +//^^^^^^ reference scip-dart pub dart:async 3.13.0 dart:async/`stream.dart`/Stream# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`async.dart`/countTo(). +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^ definition local 0 + for (var i = 1; i <= n; i++) { +// ^ definition local 1 +// ^ reference local 1 +// ^ reference local 0 +// ^ reference local 1 + yield i; +// ^ reference local 1 + } + } + + Iterable evens(int max) sync* { +//^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`iterable.dart`/Iterable# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`async.dart`/evens(). +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^ definition local 2 + for (var i = 0; i < max; i += 2) { +// ^ definition local 3 +// ^ reference local 3 +// ^^^ reference local 2 +// ^ reference local 3 + yield i; +// ^ reference local 3 + } + yield* [max]; +// ^^^ reference local 2 + } + + class CustomException implements Exception { +// ^^^^^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`async.dart`/CustomException# +// relationship scip-dart pub dart:core 3.13.0 dart:core/`exceptions.dart`/Exception# implementation +// ^^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`exceptions.dart`/Exception# + final String message; +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`async.dart`/CustomException#message. + CustomException(this.message); +// ^^^^^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`async.dart`/CustomException#``(). +// ^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`async.dart`/CustomException#message. + } + + Future main() async { +//^^^^^^ reference scip-dart pub dart:async 3.13.0 dart:async/`future.dart`/Future# +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`async.dart`/main(). + final value = await fetchValue(); +// ^^^^^ definition local 4 +// ^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`async.dart`/fetchValue(). + + await for (final i in countTo(value)) { +// ^ definition local 5 +// ^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`async.dart`/countTo(). +// ^^^^^ reference local 4 + print(i); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^ reference local 5 + } + + final controller = StreamController(); +// ^^^^^^^^^^ definition local 6 +// ^^^^^^^^^^^^^^^^ reference scip-dart pub dart:async 3.13.0 dart:async/`stream_controller.dart`/StreamController#``(). +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# + final subscription = controller.stream.listen(print); +// ^^^^^^^^^^^^ definition local 7 +// ^^^^^^^^^^ reference local 6 +// ^^^^^^ reference scip-dart pub dart:async 3.13.0 dart:async/`stream_controller.dart`/StreamController#`stream`. +// ^^^^^^ reference scip-dart pub dart:async 3.13.0 dart:async/`stream.dart`/Stream#listen(). +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). + controller.add('event'); +// ^^^^^^^^^^ reference local 6 +// ^^^ reference scip-dart pub dart:async 3.13.0 dart:async/`stream_controller.dart`/StreamController#add(). + await subscription.cancel(); +// ^^^^^^^^^^^^ reference local 7 +// ^^^^^^ reference scip-dart pub dart:async 3.13.0 dart:async/`stream.dart`/StreamSubscription#cancel(). + + try { + throw CustomException('boom'); +// ^^^^^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`async.dart`/CustomException#``(). + } on CustomException catch (e, stackTrace) { +// ^^^^^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`async.dart`/CustomException# + print('${e.message} $stackTrace'); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^ reference local 8 +// ^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`async.dart`/CustomException#message. +// ^^^^^^^^^^ reference local 9 + } on FormatException { +// ^^^^^^^^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`exceptions.dart`/FormatException# + rethrow; + } catch (e) { + print(e); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^ reference local 10 + } finally { + print('done'); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). + } + + outer: + for (final i in evens(10)) { +// ^ definition local 11 +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`async.dart`/evens(). + var j = 0; +// ^ definition local 12 + while (true) { + if (j > i) continue outer; +// ^ reference local 12 +// ^ reference local 11 + if (i > 6) break outer; +// ^ reference local 11 + j++; +// ^ reference local 12 + } + } + + var k = 0; +// ^ definition local 13 + do { + k++; +// ^ reference local 13 + } while (k < 3); +// ^ reference local 13 + + assert(k == 3, 'k should be 3'); +// ^ reference local 13 + } + diff --git a/snapshots/output/basic-project/lib/classes.dart b/snapshots/output/basic-project/lib/classes.dart new file mode 100755 index 00000000..b2e2c99a --- /dev/null +++ b/snapshots/output/basic-project/lib/classes.dart @@ -0,0 +1,329 @@ + abstract interface class Shape { +// definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/ +// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Shape# + double get area; +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`double.dart`/double# +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Shape#`area`. + } + + class Point { +// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point# + final int x; +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#x. + final int y; +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#y. + + const Point(this.x, this.y); +// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#``(). +// ^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#x. +// ^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#y. + + const Point.origin() : this(0, 0); +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point# +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#origin(). + + factory Point.fromList(List list) = _ListPoint; +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point# +// ^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#fromList(). +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`list.dart`/List# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^ definition local 0 +// ^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/_ListPoint#``(). + + static int instances = 0; +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#instances. + + static Point parse(String value) { +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point# +// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#parse(). +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^ definition local 1 + final parts = value.split(','); +// ^^^^^ definition local 2 +// ^^^^^ reference local 1 +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String#split(). + return Point(int.parse(parts[0]), int.parse(parts[1])); +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#``(). +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int#parse(). +// ^^^^^ reference local 2 +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int#parse(). +// ^^^^^ reference local 2 + } + } + + class _ListPoint extends Point { +// ^^^^^^^^^^ definition local 3 +// relationship scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point# implementation +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point# + _ListPoint(List list) : super(list[0], list[1]); +// ^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/_ListPoint#``(). +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`list.dart`/List# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^ definition local 4 +// ^^^^ reference local 4 +// ^^^^ reference local 4 + } + + class Rectangle implements Shape { +// ^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle# +// relationship scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Shape# implementation +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Shape# + final double width; +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`double.dart`/double# +// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle#width. + final double height; +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`double.dart`/double# +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle#height. + late final String description = 'Rectangle $width x $height'; +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle#description. +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle#width. +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle#height. + + Rectangle(this.width, this.height) : assert(width >= 0); +// ^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle#``(). +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle#width. +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle#height. +// ^^^^^ reference local 5 + + @override +// ^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`annotations.dart`/override. + double get area => width * height; +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`double.dart`/double# +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle#`area`. +// relationship scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Shape#`area`. implementation reference +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle#width. +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle#height. + } + + class Square extends Rectangle { +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Square# +// relationship scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle# implementation +// relationship scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Shape# implementation +// ^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle# + Square(double side) : super(side, side); +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Square#``(). +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`double.dart`/double# +// ^^^^ definition local 6 +// ^^^^ reference local 6 +// ^^^^ reference local 6 + } + + class ColoredSquare extends Square { +// ^^^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/ColoredSquare# +// relationship scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle# implementation +// relationship scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Shape# implementation +// relationship scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Square# implementation +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Square# + final String color; +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/ColoredSquare#color. + ColoredSquare(super.side, {this.color = 'red'}); +// ^^^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/ColoredSquare#``(). +// ^^^^ definition local 7 +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/ColoredSquare#color. +// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/ColoredSquare#``().(color) + } + + mixin class Walker { +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Walker# + void walk() => print('walking'); +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Walker#walk(). +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). + } + + mixin Logger on Rectangle { +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Logger# +// ^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle# + void log() => print('area: $area'); +// ^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Logger#log(). +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle#`area`. + } + + class LoggedRectangle extends Rectangle with Logger, Walker { +// ^^^^^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/LoggedRectangle# +// relationship scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Logger# implementation +// relationship scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle# implementation +// relationship scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Shape# implementation +// relationship scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Walker# implementation +// ^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle# +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Logger# +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Walker# + LoggedRectangle() : super(1, 2); +// ^^^^^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/LoggedRectangle#``(). + } + + enum Planet implements Comparable { +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet# +// ^^^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`comparable.dart`/Comparable# +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet# + mercury(mass: 3.303e+23, radius: 2.4397e6), +// ^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#mercury. +// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#``().(mass) +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#``().(radius) + earth(mass: 5.976e+24, radius: 6.37814e6); +// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#earth. +// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#``().(mass) +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#``().(radius) + + const Planet({required this.mass, required this.radius}); +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#``(). +// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#mass. +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#``().(mass) +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#radius. +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#``().(radius) + + final double mass; +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`double.dart`/double# +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#mass. + final double radius; +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`double.dart`/double# +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#radius. + + static const gravitationalConstant = 6.67300E-11; +// ^^^^^^^^^^^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#gravitationalConstant. + + double get surfaceGravity => gravitationalConstant * mass / (radius * radius); +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`double.dart`/double# +// ^^^^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#`surfaceGravity`. +// ^^^^^^^^^^^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#gravitationalConstant. +// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#mass. +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#radius. +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#radius. + + @override +// ^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`annotations.dart`/override. + int compareTo(Planet other) => mass.compareTo(other.mass); +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#compareTo(). +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet# +// ^^^^^ definition local 8 +// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#mass. +// ^^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`num.dart`/num#compareTo(). +// ^^^^^ reference local 8 +// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#mass. + } + + String greet(String name, [String greeting = 'Hello', int? times]) => +//^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/greet(). +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^ definition local 9 +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^^^^ definition local 10 +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^ definition local 11 + '$greeting $name ${times ?? 1}'; +// ^^^^^^^^ reference local 10 +// ^^^^ reference local 9 +// ^^^^^ reference local 11 + + void main() { +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`classes.dart`/main(). + const origin = Point.origin(); +// ^^^^^^ definition local 12 +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point# +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#origin(). + final fromList = Point.fromList([1, 2]); +// ^^^^^^^^ definition local 13 +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point# +// ^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#fromList(). + Point.instances++; +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point# +// ^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#instances. + Point.parse('1,2'); +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point# +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#parse(). + print([origin, fromList]); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^^^ reference local 12 +// ^^^^^^^^ reference local 13 + + final square = ColoredSquare(2, color: 'blue'); +// ^^^^^^ definition local 14 +// ^^^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/ColoredSquare#``(). +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/ColoredSquare#``().(color) + print(square.area); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^^^ reference local 14 +// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle#`area`. + print(square.description); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^^^ reference local 14 +// ^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Rectangle#description. + + LoggedRectangle() +// ^^^^^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/LoggedRectangle#``(). + ..log() +// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Logger#log(). + ..walk(); +// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Walker#walk(). + + Planet.earth.surfaceGravity; +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet# +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#earth. +// ^^^^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#`surfaceGravity`. + Planet.values.byName('mercury'); +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet# +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`enum.dart`/EnumByName#byName(). + Planet.earth.compareTo(Planet.mercury); +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet# +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#earth. +// ^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#compareTo(). +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet# +// ^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#mercury. + Planet.earth.index; +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet# +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#earth. +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`enum.dart`/Enum#`index`. + Planet.earth.name; +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet# +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Planet#earth. +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`enum.dart`/EnumName#`name`. + + greet('Bob'); +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/greet(). + greet('Bob', 'Hi', 2); +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/greet(). + + // tear-offs + final greetFn = greet; +// ^^^^^^^ definition local 15 +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/greet(). + final parseFn = Point.parse; +// ^^^^^^^ definition local 16 +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point# +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#parse(). + final ctorFn = Point.new; +// ^^^^^^ definition local 17 +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point# +// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#``(). + final namedCtorFn = Point.origin; +// ^^^^^^^^^^^ definition local 18 +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point# +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`classes.dart`/Point#origin(). + final methodFn = square.toString; +// ^^^^^^^^ definition local 19 +// ^^^^^^ reference local 14 +// ^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`object.dart`/Object#toString(). + final listOf = List.filled; +// ^^^^^^ definition local 20 +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`list.dart`/List# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`list.dart`/List#filled(). + print([greetFn, parseFn, ctorFn, namedCtorFn, methodFn, listOf]); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^^^^ reference local 15 +// ^^^^^^^ reference local 16 +// ^^^^^^ reference local 17 +// ^^^^^^^^^^^ reference local 18 +// ^^^^^^^^ reference local 19 +// ^^^^^^ reference local 20 + } + diff --git a/snapshots/output/basic-project/lib/extensions.dart b/snapshots/output/basic-project/lib/extensions.dart new file mode 100755 index 00000000..73920854 --- /dev/null +++ b/snapshots/output/basic-project/lib/extensions.dart @@ -0,0 +1,72 @@ + extension StringExtensions on String { +// definition scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/ +// ^^^^^^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/StringExtensions# +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# + String get shout => toUpperCase(); +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/StringExtensions#`shout`. +// ^^^^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String#toUpperCase(). + + bool get isBlank => trim().isEmpty; +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`bool.dart`/bool# +// ^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/StringExtensions#`isBlank`. +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String#trim(). +// ^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String#`isEmpty`. + + String repeat(int times) => List.filled(times, this).join(); +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/StringExtensions#repeat(). +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^ definition local 0 +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`list.dart`/List# +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`list.dart`/List#filled(). +// ^^^^^ reference local 0 +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`iterable.dart`/Iterable#join(). + + static String empty() => ''; +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/StringExtensions#empty(). + } + + extension on List { +// definition local 1 +// ^ definition scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/null#[T] +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`list.dart`/List# +// ^ reference scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/null#[T] + T? get secondOrNull => length > 1 ? this[1] : null; +// ^ reference scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/null#[T] +// ^^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/`secondOrNull`. +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`list.dart`/List#`length`. + } + + extension NumberParsing on String { +// ^^^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/NumberParsing# +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# + int parseInt() => int.parse(this); +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/NumberParsing#parseInt(). +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int#parse(). + } + + void main() { +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/main(). + 'hello'.shout; +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/StringExtensions#`shout`. + ' '.isBlank; +// ^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/StringExtensions#`isBlank`. + 'ab'.repeat(3); +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/StringExtensions#repeat(). + StringExtensions.empty(); +// ^^^^^^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/StringExtensions# +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/StringExtensions#empty(). + [1, 2].secondOrNull; +// ^^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/`secondOrNull`. + + // explicit extension application + StringExtensions('hi').repeat(2); +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/StringExtensions#repeat(). + NumberParsing('42').parseInt(); +// ^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`extensions.dart`/NumberParsing#parseInt(). + } + diff --git a/snapshots/output/basic-project/lib/generics.dart b/snapshots/output/basic-project/lib/generics.dart new file mode 100755 index 00000000..6e6e001c --- /dev/null +++ b/snapshots/output/basic-project/lib/generics.dart @@ -0,0 +1,178 @@ + class Box { +// definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/ +// ^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box# +// ^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box#[T] + T value; +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box#[T] +// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box#value. + Box(this.value); +// ^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box#``(). +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box#value. + + R map(R Function(T value) transform) => transform(value); +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box#map().[R] +// ^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box#map(). +// ^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box#map().[R] +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box#map().[R] +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box#[T] +// ^^^^^^^^^ definition local 0 +// ^^^^^^^^^ reference local 0 +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box#value. + } + + class NumberBox extends Box { +// ^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/NumberBox# +// relationship scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box# implementation +// ^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/NumberBox#[N] +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`num.dart`/num# +// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box# +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/NumberBox#[N] + NumberBox(super.value); +// ^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/NumberBox#``(). +// ^^^^^ definition local 1 + + N add(N other) => (value + other) as N; +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/NumberBox#[N] +// ^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/NumberBox#add(). +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/NumberBox#[N] +// ^^^^^ definition local 2 +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box#value. +// ^^^^^ reference local 2 +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/NumberBox#[N] + } + + abstract class Repository { +// ^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Repository# +// ^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Repository#[K] +// ^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Repository#[V] +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`object.dart`/Object# + V? find(K key); +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Repository#[V] +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Repository#find(). +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Repository#[K] +// ^^^ definition local 3 + void save(K key, V value); +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Repository#save(). +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Repository#[K] +// ^^^ definition local 4 +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Repository#[V] +// ^^^^^ definition local 5 + } + + class MemoryRepository implements Repository { +// ^^^^^^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/MemoryRepository# +// relationship scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Repository# implementation +// ^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/MemoryRepository#[V] +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`object.dart`/Object# +// ^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Repository# +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/MemoryRepository#[V] + final Map _store = {}; +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`map.dart`/Map# +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/MemoryRepository#[V] +// ^^^^^^ definition local 6 + + @override +// ^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`annotations.dart`/override. + V? find(String key) => _store[key]; +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/MemoryRepository#[V] +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/MemoryRepository#find(). +// relationship scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Repository#find(). implementation reference +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^ definition local 7 +// ^^^^^^ reference local 8 +// ^^^ reference local 7 + + @override +// ^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`annotations.dart`/override. + void save(String key, V value) => _store[key] = value; +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/MemoryRepository#save(). +// relationship scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Repository#save(). implementation reference +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^ definition local 9 +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/MemoryRepository#[V] +// ^^^^^ definition local 10 +// ^^^^^^ reference local 11 +// ^^^ reference local 9 +// ^^^^^ reference local 10 + } + + T firstOf(List items) => items.first; +//^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/firstOf().[T] +// ^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/firstOf(). +// ^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/firstOf().[T] +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`list.dart`/List# +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/firstOf().[T] +// ^^^^^ definition local 12 +// ^^^^^ reference local 12 +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`iterable.dart`/Iterable#`first`. + + typedef Mapper = B Function(A input); +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Mapper# +// ^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Mapper#[A] +// ^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Mapper#[B] +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Mapper#[B] +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Mapper#[A] + typedef StringMap = Map; +// ^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/StringMap# +// ^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/StringMap#[V] +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`map.dart`/Map# +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/StringMap#[V] + + void main() { +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`generics.dart`/main(). + final box = Box(1); +// ^^^ definition local 13 +// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box#``(). +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# + final str = box.map((v) => '$v'); +// ^^^ definition local 14 +// ^^^ reference local 13 +// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box#map(). +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^ definition local 15 +// ^ reference local 15 + final numBox = NumberBox(2.5); +// ^^^^^^ definition local 16 +// ^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/NumberBox#``(). + numBox.add(1.5); +// ^^^^^^ reference local 16 +// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/NumberBox#add(). + + final repo = MemoryRepository>(); +// ^^^^ definition local 17 +// ^^^^^^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/MemoryRepository#``(). +// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Box# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# + repo.save('a', box); +// ^^^^ reference local 17 +// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/MemoryRepository#save(). +// ^^^ reference local 13 + repo.find('a'); +// ^^^^ reference local 17 +// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/MemoryRepository#find(). + + firstOf([str]); +// ^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/firstOf(). +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^ reference local 14 + + Mapper mapper = (input) => '$input'; +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/Mapper# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^^ definition local 18 +// ^^^^^ definition local 19 +// ^^^^^ reference local 19 + StringMap map = {'a': 1}; +// ^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`generics.dart`/StringMap# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^ definition local 20 + print([mapper(1), map]); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^^^ reference local 18 +// ^^^ reference local 20 + } + diff --git a/snapshots/output/basic-project/lib/operators.dart b/snapshots/output/basic-project/lib/operators.dart new file mode 100755 index 00000000..11f4775a --- /dev/null +++ b/snapshots/output/basic-project/lib/operators.dart @@ -0,0 +1,217 @@ + class Vector { +// definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/ +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector# + final int x; +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#x. + final int y; +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#y. + + const Vector(this.x, this.y); +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#``(). +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#x. +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#y. + + static const zero = Vector(0, 0); +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#zero. +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#``(). + + Vector operator +(Vector other) => Vector(x + other.x, y + other.y); +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector# +// ^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#+(). +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector# +// ^^^^^ definition local 0 +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#``(). +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#x. +// ^^^^^ reference local 0 +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#x. +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#y. +// ^^^^^ reference local 0 +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#y. + Vector operator -() => Vector(-x, -y); +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector# +// ^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#-(). +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#``(). +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#x. +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#y. + int operator [](int index) => index == 0 ? x : y; +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#`[]`(). +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^ definition local 1 +// ^^^^^ reference local 1 +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#x. +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#y. + bool operator <(Vector other) => length < other.length; +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`bool.dart`/bool# +// ^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#`<`(). +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector# +// ^^^^^ definition local 2 +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#`length`. +// ^^^^^ reference local 2 +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#`length`. + + int get length => x * x + y * y; +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#`length`. +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#x. +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#x. +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#y. +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#y. + + @override +// ^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`annotations.dart`/override. + bool operator ==(Object other) => +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`bool.dart`/bool# +// ^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#`==`(). +// relationship scip-dart pub dart:core 3.13.0 dart:core/`object.dart`/Object#`==`(). implementation reference +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`object.dart`/Object# +// ^^^^^ definition local 3 + other is Vector && other.x == x && other.y == y; +// ^^^^^ reference local 3 +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector# +// ^^^^^ reference local 3 +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#x. +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#x. +// ^^^^^ reference local 3 +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#y. +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#y. + + @override +// ^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`annotations.dart`/override. + int get hashCode => Object.hash(x, y); +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#`hashCode`. +// relationship scip-dart pub dart:core 3.13.0 dart:core/`object.dart`/Object#`hashCode`. implementation reference +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`object.dart`/Object# +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`object.dart`/Object#hash(). +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#x. +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#y. + } + + class Multiplier { +// ^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Multiplier# + final int factor; +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Multiplier#factor. + Multiplier(this.factor); +// ^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Multiplier#``(). +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Multiplier#factor. + + int call(int value) => value * factor; +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Multiplier#call(). +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^ definition local 4 +// ^^^^^ reference local 4 +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Multiplier#factor. + } + + Vector? maybeVector() => null; +//^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector# +// ^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/maybeVector(). + + int _counter = 0; +//^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^^^ definition local 5 + int get counter => _counter; +//^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/`counter`. +// ^^^^^^^^ reference local 5 + set counter(int value) => _counter = value; +// ^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/`counter`. +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^ definition local 6 +// ^^^^^^^^ reference local 5 +// ^^^^^ reference local 6 + + void main() { +// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`operators.dart`/main(). + var a = const Vector(1, 2); +// ^ definition local 7 +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#``(). + var b = Vector.zero; +// ^ definition local 8 +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector# +// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#zero. + var c = a + b; +// ^ definition local 9 +// ^ reference local 7 +// ^ reference local 8 + c = -c; +// ^ reference local 9 +// ^ reference local 9 + print(c[0]); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^ reference local 9 + print(a < b); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^ reference local 7 +// ^ reference local 8 + a += b; +// ^ reference local 7 +// ^ reference local 8 + + final doubler = Multiplier(2); +// ^^^^^^^ definition local 10 +// ^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Multiplier#``(). + doubler(4); +// ^^^^^^^ reference local 10 + + counter = 5; +// ^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/`counter`. + counter++; +// ^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/`counter`. + print(counter); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/`counter`. + + Vector? maybe = maybeVector(); +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector# +// ^^^^^ definition local 11 +// ^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/maybeVector(). + maybe ??= a; +// ^^^^^ reference local 11 +// ^ reference local 7 + print(maybeVector()?.x ?? 0); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/maybeVector(). +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#x. + print(maybeVector()!.y); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/maybeVector(). +// ^ reference scip-dart pub dart_test 1.0.0 lib/`operators.dart`/Vector#y. + + final includeExtra = DateTime.now().isUtc; +// ^^^^^^^^^^^^ definition local 12 +// ^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`date_time.dart`/DateTime# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`date_time.dart`/DateTime#now(). +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`date_time.dart`/DateTime#isUtc. + final list = [ +// ^^^^ definition local 13 + 1, + ...[2, 3], + ...?null, + if (includeExtra) 4 else 5, +// ^^^^^^^^^^^^ reference local 12 + for (var i = 0; i < 3; i++) i * 10, +// ^ definition local 14 +// ^ reference local 14 +// ^ reference local 14 +// ^ reference local 14 + ]; + final set = {...list}; +// ^^^ definition local 15 +// ^^^^ reference local 13 + final map = {for (final v in set) v: '$v'}; +// ^^^ definition local 16 +// ^ definition local 17 +// ^^^ reference local 15 +// ^ reference local 17 +// ^ reference local 17 + print(map); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^ reference local 16 + } + diff --git a/snapshots/output/dart3-features/lib/class_modifiers.dart b/snapshots/output/dart3-features/lib/class_modifiers.dart new file mode 100755 index 00000000..da3583aa --- /dev/null +++ b/snapshots/output/dart3-features/lib/class_modifiers.dart @@ -0,0 +1,123 @@ + abstract interface class Flyer { +// definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/ +// ^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Flyer# + void fly(); +// ^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Flyer#fly(). + } + + abstract base class Vehicle { +// ^^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Vehicle# + void move(); +// ^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Vehicle#move(). + } + + base mixin Engine { +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Engine# + void start() => print('vroom'); +// ^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Engine#start(). +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). + } + + mixin class Musician { +// ^^^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Musician# + void play() => print('playing'); +// ^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Musician#play(). +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). + } + + final class Airplane extends Vehicle with Engine implements Flyer { +// ^^^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Airplane# +// relationship scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Engine# implementation +// relationship scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Flyer# implementation +// relationship scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Vehicle# implementation +// ^^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Vehicle# +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Engine# +// ^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Flyer# + @override +// ^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`annotations.dart`/override. + void move() => start(); +// ^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Airplane#move(). +// relationship scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Vehicle#move(). implementation reference +// ^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Engine#start(). + + @override +// ^^^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`annotations.dart`/override. + void fly() => move(); +// ^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Airplane#fly(). +// relationship scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Flyer#fly(). implementation reference +// ^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Airplane#move(). + } + + sealed class Result { +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Result# +// ^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Result#[T] + const Result(); +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Result#``(). + } + + final class Ok extends Result { +// ^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Ok# +// relationship scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Result# implementation +// ^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Ok#[T] +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Result# +// ^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Ok#[T] + final T value; +// ^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Ok#[T] +// ^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Ok#value. + const Ok(this.value); +// ^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Ok#``(). +// ^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Ok#value. + } + + final class Err extends Result { +// ^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Err# +// relationship scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Result# implementation +// ^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Err#[T] +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Result# +// ^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Err#[T] + final Object error; +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`object.dart`/Object# +// ^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Err#error. + const Err(this.error); +// ^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Err#``(). +// ^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Err#error. + } + + class Band with Musician {} +// ^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Band# +// relationship scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Musician# implementation +// ^^^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Musician# + + String describe(Result result) => switch (result) { +//^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/describe(). +// ^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/describe().[T] +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Result# +// ^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/describe().[T] +// ^^^^^^ definition local 0 +// ^^^^^^ reference local 0 + Ok(:final value) => 'ok $value', +// ^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Ok# +// ^^^^^ reference local 1 + Err(:final error) => 'err $error', +// ^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Err# +// ^^^^^ reference local 2 + }; + + void main() { +// ^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/main(). + Airplane().fly(); +// ^^^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Airplane#``(). +// ^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Airplane#fly(). + Band().play(); +// ^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Band#``(). +// ^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Musician#play(). + describe(const Ok(1)); +// ^^^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/describe(). +// ^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Ok#``(). + describe(Err('bad')); +// ^^^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/describe(). +// ^^^ reference scip-dart pub dart3_features 1.0.0 lib/`class_modifiers.dart`/Err#``(). +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# + } + diff --git a/snapshots/output/dart3-features/lib/modern.dart b/snapshots/output/dart3-features/lib/modern.dart new file mode 100755 index 00000000..b2100dc0 --- /dev/null +++ b/snapshots/output/dart3-features/lib/modern.dart @@ -0,0 +1,170 @@ + // Extension types (Dart 3.3) +// definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/ + extension type UserId(int id) { +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^ definition local 0 + UserId.fromString(String value) : this(int.parse(value)); +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId# +// ^^^^^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId#fromString(). +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^ definition local 1 +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int#parse(). +// ^^^^^ reference local 1 + + bool get isValid => id > 0; +// ^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`bool.dart`/bool# +// ^^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId#`isValid`. +// ^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId#id. + + UserId next() => UserId(id + 1); +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId# +// ^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId#next(). +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId#``(). +// ^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId#id. + } + + extension type const Meters(double value) implements double { +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Meters# +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`double.dart`/double# +// ^^^^^ definition local 2 +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`double.dart`/double# + Meters operator +(Meters other) => Meters(value + other.value); +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Meters# +// ^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Meters#+(). +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Meters# +// ^^^^^ definition local 3 +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Meters#``(). +// ^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Meters#value. +// ^^^^^ reference local 3 +// ^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Meters#value. + } + + // Wildcard variables (Dart 3.7) + void wildcards(int _, int _) { +// ^^^^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/wildcards(). +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^ definition local 4 +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^ definition local 5 + var _ = 1; +// ^ definition local 6 + final _ = 2; +// ^ definition local 7 + for (var _ in [1, 2]) {} +// ^ definition local 8 + } + + // Null-aware elements (Dart 3.8) + List nullAwareElements(String? maybe, Map source) { +//^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`list.dart`/List# +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^^^^^^^^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/nullAwareElements(). +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^ definition local 9 +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`map.dart`/Map# +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^ definition local 10 + final map = {'key': ?source['key']}; +// ^^^ definition local 11 +// ^^^^^^ reference local 10 + print(map); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^ reference local 11 + return ['always', ?maybe]; +// ^^^^^ reference local 9 + } + + enum Status { active, inactive } +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Status# +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Status#active. +// ^^^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Status#inactive. + + class Config { +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Config# + final Status status; +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Status# +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Config#status. + const Config({this.status = .active}); +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Config#``(). +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Config#status. +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Config#``().(status) +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Status#active. + + static Config get defaults => const Config(); +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Config# +// ^^^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Config#`defaults`. +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Config#``(). + } + + // Dot shorthands (Dart 3.10) + bool isActive(Status status) => status == .active; +//^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`bool.dart`/bool# +// ^^^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/isActive(). +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Status# +// ^^^^^^ definition local 12 +// ^^^^^^ reference local 12 +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Status#active. + + void main() { +// ^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/main(). + final id = UserId(1); +// ^^ definition local 13 +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId#``(). + final parsed = UserId.fromString('2'); +// ^^^^^^ definition local 14 +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId# +// ^^^^^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId#fromString(). + print([id.isValid, parsed.next().id]); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^ reference local 13 +// ^^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId#`isValid`. +// ^^^^^^ reference local 14 +// ^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId#next(). +// ^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/UserId#id. + + const length = Meters(1.5); +// ^^^^^^ definition local 15 +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Meters#``(). + print(length + Meters(2)); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^^^ reference local 15 +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Meters#``(). + + wildcards(1, 2); +// ^^^^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/wildcards(). + nullAwareElements(null, {'key': 1}); +// ^^^^^^^^^^^^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/nullAwareElements(). + + Status status = .inactive; +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Status# +// ^^^^^^ definition local 16 +// ^^^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Status#inactive. + Config config = .defaults; +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Config# +// ^^^^^^ definition local 17 +// ^^^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Config#`defaults`. + print(isActive(status)); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/isActive(). +// ^^^^^^ reference local 16 + print(config.status); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^^^ reference local 17 +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Config#status. + + switch (status) { +// ^^^^^^ reference local 16 + case .active: +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Status#active. + print('active'); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). + case .inactive: +// ^^^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`modern.dart`/Status#inactive. + print('inactive'); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). + } + } + diff --git a/snapshots/output/dart3-features/lib/patterns.dart b/snapshots/output/dart3-features/lib/patterns.dart new file mode 100755 index 00000000..47b97099 --- /dev/null +++ b/snapshots/output/dart3-features/lib/patterns.dart @@ -0,0 +1,162 @@ + sealed class Shape {} +// definition scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/ +// ^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Shape# + + class Circle extends Shape { +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Circle# +// relationship scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Shape# implementation +// ^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Shape# + final double radius; +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`double.dart`/double# +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Circle#radius. + Circle(this.radius); +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Circle#``(). +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Circle#radius. + } + + class Square extends Shape { +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Square# +// relationship scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Shape# implementation +// ^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Shape# + final double side; +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`double.dart`/double# +// ^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Square#side. + Square(this.side); +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Square#``(). +// ^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Square#side. + } + + double area(Shape shape) => switch (shape) { +//^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`double.dart`/double# +// ^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/area(). +// ^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Shape# +// ^^^^^ definition local 0 +// ^^^^^ reference local 0 + Circle(radius: final r) => 3.14 * r * r, +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Circle# +// ^ reference local 1 +// ^ reference local 1 + Square(:final side) => side * side, +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Square# +// ^^^^ reference local 2 +// ^^^^ reference local 2 + }; + + ({String name, int age}) person() => (name: 'Alice', age: 30); +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/person(). + + (int, {String label}) mixed() => (1, label: 'one'); +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# +// ^^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/mixed(). + + void main() { +// ^^^^ definition scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/main(). + final p = person(); +// ^ definition local 3 +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/person(). + print('${p.name} ${p.age}'); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^ reference local 3 +// ^ reference local 3 + + final m = mixed(); +// ^ definition local 4 +// ^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/mixed(). + print('${m.$1} ${m.label}'); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^ reference local 4 +// ^ reference local 4 + + final (:name, :age) = person(); +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/person(). + print('$name $age'); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^ reference local 5 +// ^^^ reference local 6 + + var (a, b) = (1, 2); + (a, b) = (b, a); +// ^ reference local 7 +// ^ reference local 8 + + final list = [1, 2, 3, 4]; +// ^^^^ definition local 9 + switch (list) { +// ^^^^ reference local 9 + case [final first, ...final rest]: + print('$first $rest'); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^^ reference local 10 +// ^^^^ reference local 11 + case []: + print('empty'); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). + } + + final Object? value = {'id': 1, 'tags': ['x']}; +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`object.dart`/Object# +// ^^^^^ definition local 12 + if (value case {'id': int id, 'tags': [String tag]}) { +// ^^^^^ reference local 12 +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`string.dart`/String# + print('$id $tag'); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^ reference local 13 +// ^^^ reference local 14 + } + + final int? nullable = 3; +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^^^^^^ definition local 15 + if (nullable case final n?) { +// ^^^^^^^^ reference local 15 + print(n); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^ reference local 16 + } + + final dynamic raw = 3; +// ^^^ definition local 17 + if (raw case final int asInt as int) { +// ^^^ reference local 17 +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# + print(asInt); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^^ reference local 18 + } + + final (int x, int y) = (5, 6); +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# +// ^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`int.dart`/int# + print(x + y); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^ reference local 19 +// ^ reference local 20 + + for (final (i, s) in [(1, 'a'), (2, 'b')]) { + print('$i $s'); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^ reference local 21 +// ^ reference local 22 + } + + for (final Circle(:radius) in [Circle(1), Circle(2)]) { +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Circle# +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Circle#``(). +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Circle#``(). + print(radius); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^^^ reference local 23 + } + + print(area(Circle(1))); +// ^^^^^ reference scip-dart pub dart:core 3.13.0 dart:core/`print.dart`/print(). +// ^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/area(). +// ^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/`patterns.dart`/Circle#``(). + } + diff --git a/snapshots/output/dart3-features/pubspec.yaml b/snapshots/output/dart3-features/pubspec.yaml index 6c1868bd..a8513eb3 100755 --- a/snapshots/output/dart3-features/pubspec.yaml +++ b/snapshots/output/dart3-features/pubspec.yaml @@ -3,4 +3,4 @@ publish_to: none environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.10.0 <4.0.0"