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

Improve + consolidate cycle detection #100

Merged
merged 5 commits into from
Jul 7, 2024

Conversation

dfed
Copy link
Owner

@dfed dfed commented Jul 7, 2024

Builds on top of #95 by fully consolidating our cycle detection + further improving the error message we emit when receiving a property that isn't yet fully instantiated.

@dfed dfed self-assigned this Jul 7, 2024
Copy link

codecov bot commented Jul 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.67%. Comparing base (a5c6b15) to head (0a2d42e).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #100      +/-   ##
==========================================
+ Coverage   99.63%   99.67%   +0.03%     
==========================================
  Files          47       47              
  Lines       11519    11557      +38     
==========================================
+ Hits        11477    11519      +42     
+ Misses         42       38       -4     
Files Coverage Δ
...afeDICore/Generators/DependencyTreeGenerator.swift 97.71% <100.00%> (+0.27%) ⬆️
Sources/SafeDICore/Generators/ScopeGenerator.swift 100.00% <100.00%> (+0.33%) ⬆️
...ToolTests/SafeDIToolCodeGenerationErrorTests.swift 99.89% <100.00%> (+<0.01%) ⬆️

... and 5 files with indirect coverage changes

@dfed dfed marked this pull request as ready for review July 7, 2024 21:39
@dfed dfed requested a review from MrAdamBoyd July 7, 2024 21:44
.union(scope.properties),
property: property,
.union(scope.properties)
.removing(childProperty),
Copy link
Owner Author

Choose a reason for hiding this comment

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

brought this line back from #95. Now that we're doing our cycle checking before we're doing our "initialized in chain" checking, we can make this more semantically correct

@@ -351,58 +351,43 @@ actor ScopeGenerator: CustomStringConvertible, Sendable {
private var generateCodeTask: Task<String, Error>?

private var orderedPropertiesToGenerate: [ScopeGenerator] {
get throws {
Copy link
Owner Author

Choose a reason for hiding this comment

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

we no longer need to throw here since we do this checking much earlier now. best reviewed with whitespace turned off

Comment on lines +963 to +964
Dependency received in same chain it is instantiated!
@Instantiated a: A -> @Received renamedB: B -> @Received c: C -> @Received a: A
Copy link
Owner Author

Choose a reason for hiding this comment

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

this test better mirrors the above test. I liked the parallelism

@dfed dfed merged commit c6da5d6 into main Jul 7, 2024
13 checks passed
@dfed dfed deleted the dfed--more-cycle-detection-improvements branch July 7, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant