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

Feature/attribs on params #74

Merged
merged 6 commits into from Feb 8, 2018

Conversation

@kevinwright
Copy link
Contributor

@kevinwright kevinwright commented Feb 1, 2018

Added test for annotation capture
Updated to lamdafied syntax for SAM type construction
Minor changes to permit compilation under JDK 9
Added Kevin Wright as a contributor

kevinwright added 5 commits Jan 26, 2018
Added test for annotation capture
Updated to lamdafied syntax for SAM type construction
Minor changes to permit compilation under JDK 9
Added Kevin Wright as a contributor
Copy link
Owner

@propensive propensive left a comment

Not much needs changing, though there are a few things in the comments. Generally looks really good, and lots of nice tweaks elsewhere - I had no issue with any of the material changes! Thank you!

@@ -27,13 +27,21 @@ lazy val tests = project
.settings(moduleName := "magnolia-tests")
.settings(
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full),
initialCommands in console := """import magnolia.tests._; import magnolia.examples._;""",

This comment has been minimized.

@propensive

propensive Feb 8, 2018
Owner

Nice. :)

build.sbt Outdated
libraryDependencies ++= Seq(
"com.fommil" %% "deriving-macro" % "0.9.0",
"com.fommil" %% "scalaz-deriving" % "0.9.0"
"com.fommil" %% "scalaz-deriving" % "0.9.0",

This comment has been minimized.

@propensive

propensive Feb 8, 2018
Owner

Looks like scalaz-deriving crept back in... can we drop it?

This comment has been minimized.

@kevinwright

kevinwright Feb 8, 2018
Author Contributor

done

build.sbt Outdated
@@ -84,12 +92,15 @@ lazy val publishSettings = Seq(
<name>Jon Pretty</name>
<url>https://github.com/propensive/magnolia/</url>
</developer>
<developer>

This comment has been minimized.

@propensive

propensive Feb 8, 2018
Owner

I've been using the CONTRIBUTORS file to manage this, though I'm not sure what is convention, or best practice, except that using a combination of both almost certainly isn't. Any ideas?

This comment has been minimized.

@kevinwright

kevinwright Feb 8, 2018
Author Contributor

done

@@ -25,6 +25,8 @@ trait Subtype[Typeclass[_], Type] {

/** partial function defined the subset of values of `Type` which have the type of this subtype */
def cast: PartialFunction[Type, SType]

override def toString: String = s"Subtype(${typeName.full})"

This comment has been minimized.

@propensive

propensive Feb 8, 2018
Owner

Very welcome. :)

@@ -128,7 +142,7 @@ abstract class CaseClass[Typeclass[_], Type] private[magnolia] (

/** constructs a new instance of the case class type
*
* Like [[construct]] this method is implemented by Magnolia and let's you construct case class
* Like [[construct]] this method is implemented by Magnolia and lets you construct case class

This comment has been minimized.

@propensive

propensive Feb 8, 2018
Owner

Hanging my head in shame.

param.typeclass.show(param.dereference(value))
} else {
val paramStrings = ctx.parameters.map { param =>
val attribStr = if(param.annotations.isEmpty) "" else {

This comment has been minimized.

@propensive

propensive Feb 8, 2018
Owner

Nice addition!

This comment has been minimized.

@kevinwright

kevinwright Feb 8, 2018
Author Contributor

Had to be able to test it somehow :)

implicit val string: Show[String, String] = new Show[String, String] {
def show(s: String): String = s
}
implicit val string: Show[String, String] = (s: String) => s

This comment has been minimized.

@propensive

propensive Feb 8, 2018
Owner

identity? ;)

This comment has been minimized.

@kevinwright

kevinwright Feb 8, 2018
Author Contributor

Nope, tried that...

This comment has been minimized.

@@ -1,5 +1,5 @@
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0-M1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")

This comment has been minimized.

@propensive

propensive Feb 8, 2018
Owner

Build maintenance: much appreciated!

@@ -1,12 +1,13 @@
package magnolia.tests

import language.experimental.macros
import estrapade.{test, TestApp}
import estrapade.{TestApp, test}

This comment has been minimized.

@propensive

propensive Feb 8, 2018
Owner

Sure, why not!

This comment has been minimized.

@kevinwright

kevinwright Feb 8, 2018
Author Contributor

Blame intellij :)

}.assert(_ == "scala.Symbol cannot be cast to java.lang.Integer")
}.assert{x =>
//tiny hack because Java 9 inserts the "java.base/" module name in the error message
x.startsWith("scala.Symbol cannot be cast to") && x.endsWith("java.lang.Integer")

This comment has been minimized.

@propensive

propensive Feb 8, 2018
Owner

That's horrible. But we're in test code now, so pragmatism reigns!

@propensive propensive merged commit b562503 into propensive:master Feb 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants