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

classlib: Fix NamedControl spec arg (if nil, do not overwrite metadata) #4817

Merged
merged 1 commit into from
Mar 26, 2020

Conversation

jamshark70
Copy link
Contributor

Purpose and Motivation

Fixes #4816 .

Formerly, res.spec = spec at the bottom of NamedControl *new would overwrite a spec in metadata with the default ControlSpec.

(Note that the unit test can't use assertEquals on the spec objects -- I tried it but it fails spuriously. No time to debug that, so I just test same/different maxval.)

Types of changes

  • Bug fix

To-do list

  • Code is tested
  • All tests are passing
  • Updated documentation (n/a)
  • This PR is ready for review

@jamshark70 jamshark70 added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: class library SC class library labels Mar 11, 2020
@jamshark70 jamshark70 requested a review from scztt March 11, 2020 02:55
@dyfer dyfer self-requested a review March 15, 2020 04:42
Copy link
Member

@dyfer dyfer left a comment

Choose a reason for hiding this comment

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

I tested this and this seem to work. The nil spec does not overwrite the one from the metadata. Tests pass as well. Maybe @scztt should take a look before we merge? Otherwise looks good to me.

@jamshark70
Copy link
Contributor Author

I do have a question about this.spec !? _.setFrom(spec) (line 189 or thereabouts). Instead of replacing the spec belonging to the NamedControl with a different object, it may overwrite the parameters in the existing object. That kind of side effect, I think, is something we usually try to avoid.

@scztt what's the use case for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: class library SC class library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants