Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

Define OptJsonWriter & put it on AttributeKey #73

Merged
merged 4 commits into from
Mar 21, 2017
Merged

Define OptJsonWriter & put it on AttributeKey #73

merged 4 commits into from
Mar 21, 2017

Conversation

dwijnand
Copy link
Member

No description provided.

Simply

    import OptJsonWriter.OptOut._

And you'll get the implicit lift, but not the implicit fallback.

You get an ambiguous compile error like this:

    [error] /d/sbt-util/internal/util-collection/src/main/scala/sbt/util/OptJsonWriter.scala:28: ambiguous implicit values:
    [error]  both method conflictingFallback1 in trait OptOut0 of type [A]=> sbt.util.NoJsonWriter[A]
    [error]  and method conflictingFallback2 in trait OptOut0 of type [A]=> sbt.util.NoJsonWriter[A]
    [error]  match expected type sbt.util.OptJsonWriter[Foo]
    [error]     val x = implicitly[OptJsonWriter[Foo]]
    [error]                       ^

trait OptOut0 {
implicit def conflictingFallback1[A]: NoJsonWriter[A] = NoJsonWriter()
implicit def conflictingFallback2[A]: NoJsonWriter[A] = NoJsonWriter()
Copy link
Member

Choose a reason for hiding this comment

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

Omg.

Copy link
Member Author

Choose a reason for hiding this comment

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

🙂

implicit def conflictingFallback1[A]: NoJsonWriter[A] = NoJsonWriter()
implicit def conflictingFallback2[A]: NoJsonWriter[A] = NoJsonWriter()
}
object OptOut extends OptOut0 {
Copy link
Member

Choose a reason for hiding this comment

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

Double "opt" is kind of confusing, so can we rename this to StrictMode?

@eed3si9n eed3si9n merged commit 6c768a1 into sbt:1.0 Mar 21, 2017
@dwijnand dwijnand deleted the self-serialisable-attrkeys branch March 21, 2017 23:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants