Closed
Description
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:
- Variable
CLASSPATH_SUFFIX
in filedist/bin/common
is unused and can be removed. - Variable
DOTTY_CONSUME_TASTY
must be renamed toDOTTY_TASTY_INSPECTOR
(and its value must be updated). - I also appended variable
DOTTY_TASTY_INSPECTOR
to variabletoolchain
in filedist/bin/dotc
(just afterDOTTY_STAGING
). - I also updated variables
PROG_HOME
andJAVA_HOME
and functionfind_lib
to work correctly on MingW64 (someone should test/confirm that last change !).