Skip to content

Release 0.22.0-RC1 : file dotty-tasty-inspector_0.22-0.22.0-RC1.jar is missing #8218

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

Closed
michelou opened this issue Feb 5, 2020 · 11 comments
Closed
Assignees

Comments

@michelou
Copy link
Contributor

michelou commented Feb 5, 2020

Minimized code

Let's choose a test sample using the TASTy Inspector, e.g. Foo.scala, Test.scala.

Compilation output

Using MSYS2-x64:

$ /c/opt/dotty-0.22.0-RC1/bin/dotc -d /tmp/classes tests/run-custom-args/tasty-inspector/tasty-inspector/Foo.scala tests/run-custom-args/tasty-inspector/tasty-inspector/Test.scala
-- [E008] Member Not Found Error: tests\run-custom-args\tasty-inspector\tasty-inspector\Test.scala:2:19
2 |import scala.tasty.inspector._
  |       ^^^^^^^^^^^^^^^^^^^^^
  |       value inspector is not a member of tasty
-- [E008] Member Not Found Error: tests\run-custom-args\tasty-inspector\tasty-inspector\Test.scala:6:22
6 |    new DBInspector().inspect("", List("Foo"))
  |    ^^^^^^^^^^^^^^^^^^^^^^^^^
  |    value inspect is not a member of DBInspector
2 errors found

Using the Windows command prompt (batch files):

> cd
W:\dotty

> c:\opt\dotty-0.22.0-RC1\bin\dotc -d c:\temp\classes tests\run-custom-args\tasty-inspector\tasty-inspector\Foo.scala tests\run-custom-args\tasty-inspector\tasty-inspector\Test.scala
-- [E008] Member Not Found Error: tests\run-custom-args\tasty-inspector\tasty-inspector\Test.scala:2:19
2 |import scala.tasty.inspector._
  |       ^^^^^^^^^^^^^^^^^^^^^
  |       value inspector is not a member of tasty
-- [E008] Member Not Found Error: tests\run-custom-args\tasty-inspector\tasty-inspector\Test.scala:6:22
6 |    new DBInspector().inspect("", List("Foo"))
  |    ^^^^^^^^^^^^^^^^^^^^^^^^^
  |    value inspect is not a member of DBInspector
2 errors found

Expectation

The compilation succeeds and the test execution produces the expected result:

Using MSYS2-x64:

$ /c/opt/dotty-0.22.0-RC1a/bin/dotr -with-compiler -classpath /tmp/classes Test
ClassDef("Foo", DefDef("<init>", Nil, List(Nil), Inferred(), None), List(Apply(Select(New(Inferred()), "<init>"), Nil)), Nil, None, List(ValDef("foo", TypeIdent("Int"), Some(Literal(Constant(2)))), DefDef("bar", Nil, List(List(ValDef("i", TypeIdent("Int"), None))), TypeIdent("Int"), Some(Literal(Constant(3))))))
DefDef("<init>", Nil, List(Nil), Inferred(), None)
ValDef("foo", TypeIdent("Int"), Some(Literal(Constant(2))))
DefDef("bar", Nil, List(List(ValDef("i", TypeIdent("Int"), None))), TypeIdent("Int"), Some(Literal(Constant(3))))
ValDef("i", TypeIdent("Int"), None)

Using the Windows command prompt (batch files):

> c:\opt\dotty-0.22.0-RC1a\bin\dotr -with-compiler -classpath c:\temp\classes Test
ClassDef("Foo", DefDef("<init>", Nil, List(Nil), Inferred(), None), List(Apply(Select(New(Inferred()), "<init>"), Nil)), Nil, None, List(ValDef("foo", TypeIdent("Int"), Some(Literal(Constant(2)))), DefDef("bar", Nil, List(List(ValDef("i", TypeIdent("Int"), None))), TypeIdent("Int"), Some(Literal(Constant(3))))))
DefDef("<init>", Nil, List(Nil), Inferred(), None)
ValDef("foo", TypeIdent("Int"), Some(Literal(Constant(2))))
DefDef("bar", Nil, List(List(ValDef("i", TypeIdent("Int"), None))), TypeIdent("Int"), Some(Literal(Constant(3))))
ValDef("i", TypeIdent("Int"), None)

Solution

Step 1

Copy the missing file dotty-tasty-inspector_0.22-0.22.0-RC1.jar from the Maven repo into directory $DOTTY_HOME/lib/ of the Dotty installation.

Step 2

Update the bash scripts as follows (tested with MSYS2-x64):

$ for i in common dotc dotd dotr; do diff /c/opt/dotty-0.22.0-RC1/bin/$i /c/opt/dotty-0.22.0-RC1a/bin/$i; done
68d67
< CLASSPATH_SUFFIX=""
78d76
<   CLASSPATH_SUFFIX=";"
85c83
<     PROG_HOME="`(cd "$PROG_HOME"; pwd -W | sed 's|/|\\\\|g')`"
---
>     PROG_HOME=`cygpath -u "$PROG_HOME"`
87,89c85,86
<     JAVA_HOME="`(cd "$JAVA_HOME"; pwd -W | sed 's|/|\\\\|g')`"
<   CLASSPATH_SUFFIX=";"
<   PSEP=";"
---
>     JAVA_HOME=`cygpath -u "$JAVA_HOME"`
>   PSEP=":"
101c98
<     echo $lib | sed 's|/|\\\\|g'
---
>     echo $lib
111c108
< DOTTY_CONSUME_TASTY=$(find_lib "*dotty-consume-tasty*")
---
> DOTTY_TASTY_INSPECTOR=$(find_lib "*dotty-tasty-inspector*")
66a67
>   toolchain+="$DOTTY_TASTY_INSPECTOR$PSEP"
105c105
<     cp_arg+="$PSEP$DOTTY_COMP$PSEP$TASTY_CORE$PSEP$DOTTY_INTF$PSEP$SCALA_ASM$PSEP$DOTTY_STAGING$PSEP$DOTTY_CONSUME_TASTY"
---
>     cp_arg+="$PSEP$DOTTY_COMP$PSEP$TASTY_CORE$PSEP$DOTTY_INTF$PSEP$SCALA_ASM$PSEP$DOTTY_STAGING$PSEP$DOTTY_TASTY_INSPECTOR"

Notes:

  1. Variable CLASSPATH_SUFFIX in file dist/bin/common is unused and can be removed.
  2. Variable DOTTY_CONSUME_TASTY must be renamed to DOTTY_TASTY_INSPECTOR (and its value must be updated).
  3. I also appended variable DOTTY_TASTY_INSPECTOR to variable toolchainin file dist/bin/dotc (just after DOTTY_STAGING).
  4. I also updated variables PROG_HOME and JAVA_HOME and function find_lib to work correctly on MingW64 (someone should test/confirm that last change !).
@nicolasstucki
Copy link
Contributor

Step 1 was needed because dotty-tasty-inspector was not included here
https://github.com/lampepfl/dotty/blob/master/project/Build.scala#L1385

@michelou
Copy link
Contributor Author

michelou commented Feb 6, 2020

That's correct, but from a user perspective (i.e. someone running a 0.22.0-RC1 installation), Step 1 is required. Do we agree that notes 1 and 4 in Step 2 are still pending ?!

@nicolasstucki
Copy link
Contributor

Indeed.

#8224 will fix them, but 0.22.0-RC1 will need your patch. We could consider a 0.22.0-RC2 to fix it.

@michelou
Copy link
Contributor Author

michelou commented Feb 6, 2020

IMO a 0.22.0-RC2 only to fix it is not useful assuming most people experimenting with TASTy are running a nightly build.

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Feb 6, 2020
nicolasstucki added a commit that referenced this issue Feb 6, 2020
Fix #8218: Add missing TASTy Inspector dependency in dist/pack
@nicolasstucki nicolasstucki reopened this Feb 6, 2020
@nicolasstucki
Copy link
Contributor

Nightly builds should be fixed from tomorrow on (see #8224).

We should test it before we close this issue. @michelou could you test it on Windows?

@michelou
Copy link
Contributor Author

michelou commented Feb 6, 2020

I confirm it now works using the Windows command prompt (batch files):

> cd
W:\dotty

> c:\opt\dotty-0.23.0-bin-SNAPSHOT\bin\dotc -d c:\temp\classes tests\run-custom-args\tasty-inspector\tasty-inspector\Foo.scala tests\run-custom-args\tasty-inspector\tasty-inspector\Test.scala

> c:\opt\dotty-0.23.0-bin-SNAPSHOT\bin\dotr -with-compiler -classpath c:\temp\classes Test
ClassDef("Foo", DefDef("<init>", Nil, List(Nil), Inferred(), None), List(Apply(Select(New(Inferred()), "<init>"), Nil)), Nil, None, List(ValDef("foo", TypeIdent("Int"), Some(Literal(Constant(2)))), DefDef("bar", Nil, List(List(ValDef("i", TypeIdent("Int"), None))), TypeIdent("Int"), Some(Literal(Constant(3))))))
DefDef("<init>", Nil, List(Nil), Inferred(), None)
ValDef("foo", TypeIdent("Int"), Some(Literal(Constant(2))))
DefDef("bar", Nil, List(List(ValDef("i", TypeIdent("Int"), None))), TypeIdent("Int"), Some(Literal(Constant(3))))
ValDef("i", TypeIdent("Int"), None)

Using MSYS2-x64 it only works if file bin/common is patched as described in Step 2 (see above).

$ pwd
/w/dotty

$ /c/opt/dotty-0.23.0-bin-SNAPSHOT/bin/dotc -d /c/Temp/classes tests/run-custom-args/tasty-inspector/tasty-inspector/Foo.scala tests/run-custom-args/tasty-inspector/tasty-inspector/Test.scala

$ /c/opt/dotty-0.23.0-bin-SNAPSHOT/bin/dotr -with-compiler -classpath /c/Temp/classes Test                              ClassDef("Foo", DefDef("<init>", Nil, List(Nil), Inferred(), None), List(Apply(Select(New(Inferred()), "<init>"), Nil)), Nil, None, List(ValDef("foo", TypeIdent("Int"), Some(Literal(Constant(2)))), DefDef("bar", Nil, List(List(ValDef("i", TypeIdent("Int"), None))), TypeIdent("Int"), Some(Literal(Constant(3))))))
DefDef("<init>", Nil, List(Nil), Inferred(), None)
ValDef("foo", TypeIdent("Int"), Some(Literal(Constant(2))))
DefDef("bar", Nil, List(List(ValDef("i", TypeIdent("Int"), None))), TypeIdent("Int"), Some(Literal(Constant(3))))
ValDef("i", TypeIdent("Int"), None)

Reminder: My diffs for file bin/common are specific to the mingw environment:

$ diff /c/opt/dotty-0.23.0-aaa-SNAPSHOT/bin/common /c/opt/dotty-0.23.0-bin-SNAPSHOT/bin/common
68d67
< CLASSPATH_SUFFIX=""
78d76
<   CLASSPATH_SUFFIX=";"
85c83
<     PROG_HOME="`(cd "$PROG_HOME"; pwd -W | sed 's|/|\\\\|g')`"
---
>     PROG_HOME=`cygpath -u "$PROG_HOME"`
87,89c85,86
<     JAVA_HOME="`(cd "$JAVA_HOME"; pwd -W | sed 's|/|\\\\|g')`"
<   CLASSPATH_SUFFIX=";"
<   PSEP=";"
---
>     JAVA_HOME=`cygpath -u "$JAVA_HOME"`
>   PSEP=":"
101c98
<     echo $lib | sed 's|/|\\\\|g'
---
>     echo $lib

PS.: In section Inspecting TASTy files of the Dotty online documention dotc doesn't need option -with-compiler. Running dotc -d out Test.scala is fine !

@nicolasstucki
Copy link
Contributor

Updating docs in #8227

nicolasstucki added a commit that referenced this issue Feb 7, 2020
Fix #8218: Add missing TASTy Inspector dependency in dist/pack
@michelou
Copy link
Contributor Author

Main issue is solved. Note 4 (specific to mingw platform) can be handled in another PR.

@nicolasstucki
Copy link
Contributor

@michelou could you open a PR with those fixes?

@michelou
Copy link
Contributor Author

Yes, I will.

@michelou
Copy link
Contributor Author

@nicolasstucki Note 4 solved with PR #11489.

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

No branches or pull requests

2 participants