Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

FEDX-2227: Fixed logic for constructor references #165

Merged
merged 7 commits into from
Jan 3, 2025

Conversation

matthewnitschke-wk
Copy link
Contributor

@matthewnitschke-wk matthewnitschke-wk commented Dec 19, 2024

FEDX-2227

Issue Status

Closes #164
Closes #163

@@ -95,7 +95,7 @@
// ^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int#
// ^^^^^ definition local 5
Foo(1, value: true, value2: '');
// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#
// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#`<constructor>`().
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -77,6 +76,13 @@
}
}

factory Animal.cat() => Animal('Timmy', type: AnimalType.cat);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very frustratingly, in named constructors, Animal.cat() there is only a single identifier

Screenshot 2024-12-19 at 10 57 04 AM

This isn't the case for SimpleIdentifiers for the call sight, but only the constructor declarations

The result of this, is we can only index a single element here, and I've decided to index, the arguably more important, definition for cat()

factory Animal.cat() => ...
//      ^^^^^^ NOT INDEXED
//             ^^^ definition ... Animal#cat().

Solving this is a problem for another day...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created a ticket to track this here: #166

@matthewnitschke-wk matthewnitschke-wk marked this pull request as ready for review December 19, 2024 18:13
@bender-wk bender-wk changed the title Fixed logic for constructor references FEDX-2227: Fixed logic for constructor references Dec 19, 2024
alanknight-wk
alanknight-wk previously approved these changes Jan 2, 2025
Copy link

@alanknight-wk alanknight-wk left a comment

Choose a reason for hiding this comment

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

Two comment nits, otherwise LGTM

@@ -44,6 +44,38 @@ class SymbolGenerator {
} else if (node is SimpleIdentifier) {
var element = node.staticElement;

// A SimpleIdentifier with a direct parent of a ConstructorDeclaration
// is the reference to the class itself. In scip, we want to ignore
// this as the constructor has its own definition, and only that

Choose a reason for hiding this comment

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

Is there a missing end of sentence here?

if (parentConstructor != null) {
// ConstructorNames can also include an import PrefixIdentifier: `math.Rectangle()`
// both 'math' and 'Rectangle' are SimpleIdentifiers. We only want the constructor
// element fo 'Rectangle' in this case

Choose a reason for hiding this comment

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

spelling nit: 'fo'

@matthewbelisle-wf
Copy link

Going to close and re-open this, trying to fix one of the CI errors.

@matthewnitschke-wk
Copy link
Contributor Author

QA +1

  • CI does indeed pass, snapshots look good!

🚀 @Workiva/release-management-p 🚢

Copy link

@rmconsole-wf rmconsole-wf left a comment

Choose a reason for hiding this comment

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

+1 from RM

@btr-rmconsole-1 btr-rmconsole-1 bot merged commit 69ac3b4 into master Jan 3, 2025
23 checks passed
@btr-rmconsole-1 btr-rmconsole-1 bot deleted the fixed_constructor_references branch January 3, 2025 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Constructors are incorrectly references to the class Constructor references point to class definitions
4 participants