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

Deprecate .value extension method from input tasks #2709

Merged
merged 5 commits into from
Aug 26, 2016

Conversation

eed3si9n
Copy link
Member

@eed3si9n eed3si9n commented Aug 25, 2016

Calling .value method on an input task returns InputTask[A], which
is completely unintuitive and often results to a bug.
In most cases .evaluated should be called, which returns A by
evaluating the task. Just in case InputTask[A] is needed,
toInputTask method is now provided.

note

Implicit for .value is on Initialize[T]:

  implicit def macroValueI[T](in: Initialize[T]): MacroValue[T] = ???

For instance, in case of Initalize[InputTask[Unit]], T is InputTask[Unit], so we're checking tpe to conform to Initialize[InputTask[InputTask[Unit]]], which I don't think would ever match. Fixing the semantics of .value at this juncture is dangerous, so the best we can do is remove it and tell people to use .evaluated.

/review @dwijnand, @jsuereth, @Duhemm

Calling `.value` method on an input task returns `InputTask[A]`, which
is completely unintuitive and often results to a bug.
In most cases `.evaluated` should be called, which returns `A` by
evaluating the task. Just in case `InputTask[A]` is needed,
`toInputTask` method is now provided.
else if (tpe <:< c.weakTypeOf[Task[T]])
InputWrapper.wrapTask[T](c)(ts, pos)
else if (tpe <:< c.weakTypeOf[InputTask[T]])
InputWrapper.wrapInputTask[T](c)(ts, pos)
Copy link
Contributor

Choose a reason for hiding this comment

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

What about the case when tpe <:< c.weakTypeOf[InputTask[T]] is true? Why can it be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

See Note I just added to the description of this issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

This makes sense, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I was wrong on the initial analysis. It doesn't match during .value but it does get used in some other code path. Added it back 7250285 with a better test.

@eed3si9n eed3si9n changed the title .value extension method is removed from input tasks Remove .value extension method from input tasks Aug 25, 2016
@eed3si9n eed3si9n added this to the 0.13.13 milestone Aug 25, 2016
@dwijnand
Copy link
Member

Why are we breaking this in 0.13? Why not deprecate with replacement in 0.13 and replace/remove in 1.0.

@eed3si9n
Copy link
Member Author

Because I want to break things when we can during the tech preview (0.13.5 onward).
I don't think there's harm here since plugin bincompat won't be affected.

@dwijnand
Copy link
Member

I thought we want to experiment and preview changes, without breaking backwards compatibility (until 1.0), both binary compatibility and source compatibility I assumed, and this is breaking source compatibility.

@eed3si9n eed3si9n changed the title Remove .value extension method from input tasks Deprecate .value extension method from input tasks Aug 25, 2016
@eed3si9n
Copy link
Member Author

@dwijnand Changed to deprecation.

eed3si9n added a commit to eed3si9n/sbt that referenced this pull request Aug 25, 2016
Calling `.value` method on an input task returns `InputTask[A]`, which
is completely unintuitive and often results to a bug.

In most cases `.evaluated` should be called, which returns `A` by
evaluating the task. Just in case `InputTask[A]` is needed,
`toInputTask` method is now provided.
eed3si9n added a commit to eed3si9n/sbt that referenced this pull request Aug 26, 2016
Calling `.value` method on an input task returns `InputTask[A]`, which
is completely unintuitive and often results to a bug.

In most cases `.evaluated` should be called, which returns `A` by
evaluating the task. Just in case `InputTask[A]` is needed,
`toInputTask` method is now provided.
inputTaskValue is probably a better name since taskValue exists.
@eed3si9n eed3si9n merged commit 6631456 into sbt:0.13 Aug 26, 2016
@eed3si9n eed3si9n deleted the wip/inputtask_value branch August 26, 2016 18:44
dwijnand pushed a commit that referenced this pull request Aug 29, 2016
* Remove .value from input tasks. Ref #2709

Calling `.value` method on an input task returns `InputTask[A]`, which
is completely unintuitive and often results to a bug.

In most cases `.evaluated` should be called, which returns `A` by
evaluating the task. Just in case `InputTask[A]` is needed,
`toInputTask` method is now provided.

* Fixed test

* Rename toInputTask to inputTaskValue
eed3si9n added a commit to eed3si9n/sbt that referenced this pull request Aug 29, 2016
Calling `.value` method on an input task returns `InputTask[A]`, which
is completely unintuitive and often results to a bug.

In most cases `.evaluated` should be called, which returns `A` by
evaluating the task. Just in case `InputTask[A]` is needed,
`toInputTask` method is now provided.
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.

None yet

3 participants