Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix decoration logic for paramSingle #317

Merged
merged 2 commits into from
Feb 8, 2022
Merged

Conversation

sywhang
Copy link
Contributor

@sywhang sywhang commented Feb 6, 2022

When building paramSingle using decorators, there was a descrepancy when
the invoking Scope does not have a decorator for the type but one of its
parent Scopes does. This resulted in the parent Scope having to Invoke
a function that uses the decorated type for the child to start seeing it
too.

This fixes paramSingle to search all effective scopes for a decorator
and invoke that instead of searching just the scope it was invoked from.

Fixes #316

When building paramSingle using decorators, there was a descrepancy when
the invoking Scope does not have a decorator for the type but one of its
parent Scopes does. This resulted in the parent Scope having to Invoke
a function that uses the decorated type for the child to start seeing it
too.

This fixes paramSingle to search all effective scopes for a decorator
and invoke that instead of searching just the scope it was invoked from.

Fixes uber-go#316
@codecov
Copy link

codecov bot commented Feb 6, 2022

Codecov Report

Merging #317 (394ba85) into master (1d9f0f1) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #317   +/-   ##
=======================================
  Coverage   98.41%   98.42%           
=======================================
  Files          21       21           
  Lines        1392     1398    +6     
=======================================
+ Hits         1370     1376    +6     
  Misses         14       14           
  Partials        8        8           
Impacted Files Coverage Δ
param.go 98.02% <100.00%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1d9f0f1...394ba85. Read the comment docs.

Copy link
Collaborator

@abhinav abhinav left a comment

Choose a reason for hiding this comment

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

why were the name fields renamed? that seems unrelated.

decorate_test.go Outdated Show resolved Hide resolved
decorate_test.go Outdated Show resolved Hide resolved
param.go Outdated Show resolved Hide resolved
@sywhang sywhang merged commit 8193c7f into uber-go:master Feb 8, 2022
@sywhang sywhang deleted the decoration-fix branch February 8, 2022 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Decorators at parent level scope affects child only after an invoke at parent scope
2 participants