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

work around nsc.Settings ignoring -D user-set state #11

Closed
m50d opened this issue Mar 2, 2018 · 6 comments
Closed

work around nsc.Settings ignoring -D user-set state #11

m50d opened this issue Mar 2, 2018 · 6 comments
Labels

Comments

@m50d
Copy link

m50d commented Mar 2, 2018

As discussed on issue #10 , I'd like to pass -Dkp:genAsciiNames=true to the compiler.

@Andrei-Pozolotin Andrei-Pozolotin changed the title Config option to pass a JVM parameter to the compiler work around nsc.Settings ignoring -D user-set state Mar 2, 2018
@Andrei-Pozolotin
Copy link
Contributor

@m50d

  1. please verify fix in fresh 1.4.0:
    https://bintray.com/random-maven/maven/scalor-maven-plugin_2.12
  2. working project example for reference:
    https://github.com/random-maven/scalor-maven-plugin/blob/develop/demo/pom.xml#L240
    https://github.com/random-maven/scalor-maven-plugin/blob/develop/demo/pom.xml#L316
  3. a way to test is:
  • delete ${project.basedir}/.settings/...
  • issue from menu: ${project} -> Maven -> Update Project ...

@m50d
Copy link
Author

m50d commented Mar 2, 2018

I can't find any way to confirm whether the ascii names have actually been applied in 2.12 - both scalap and the -Xprint:kind-projector parameter print with the parameters used in type lambdas as ?$0$ etc.. I remember previous versions of scala behaving differently but can't now reproduce. Suggest treating this as fixed? Sorry I didn't think through my use case thoroughly enough.

@Andrei-Pozolotin
Copy link
Contributor

  1. try to view with http://jd.benow.ca/
  2. try to access expected generated member via reflection
  3. post a minimal working project somewhere so I can take a look

@m50d
Copy link
Author

m50d commented Mar 3, 2018

I don't think the generated type names exist at all in the Java bytecode - see https://github.com/non/kind-projector#under-the-hood for the kind of code that gets generated, the type Λ is entirely gone at runtime. I can link a minimal project with kind-projector set up and running if you want, but I can't find any way to distinguish whether it was using ascii names or not.

@Andrei-Pozolotin
Copy link
Contributor

  1. the following test:

https://github.com/random-maven/scalor-maven-plugin/blob/develop/demo/src/macro/scala/meta/MacroBundle.scala#L19

https://github.com/random-maven/scalor-maven-plugin/blob/develop/demo/src/macro/scala/meta/Macro.scala#L17

https://github.com/random-maven/scalor-maven-plugin/blob/develop/demo/src/main/scala/kind/SystemProperty.scala#L11

https://github.com/random-maven/scalor-maven-plugin/blob/develop/demo/src/test/scala/kind/SystemPropertyTest.scala#L14

  1. shows both in Maven and Eclipse
Running kind.SystemPropertyTest
property=null
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.292 sec - in kind.SystemPropertyTest
  1. meaning that -D options are not propagated by compiler,
    at least in macro context, although it still may work in plugin context

  2. since suggested way to alter plugin behavior is -P
    you may want send PR to https://github.com/non/kind-projector
    i.e. -P:scalajs:sjsDefinedByDefault
    https://www.scala-js.org/doc/interoperability/sjs-defined-js-classes.html
    and also use some logging to verify options activation

@Andrei-Pozolotin
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants