Skip to content

Fix #4066 ./bin/dotr -language:Scala2 fails #4598

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

Merged
merged 2 commits into from
May 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dist/bin/dotc
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ case "$1" in
-no-colors) unset colors && shift ;;
-with-compiler) jvm_cp_args="$PSEP$DOTTY_COMP" && shift ;;

# break out -D and -J options and add them to JAVA_OPTS as well
# so they reach the JVM in time to do some good. The -D options
# break out -D and -J options and add them to java_args so
# they reach the JVM in time to do some good. The -D options
# will be available as system properties.
-D*) addJava "$1" && addScala "$1" && shift ;;
-J*) addJava "${1:2}" && addScala "$1" && shift ;;
-D*) addJava "$1" && shift ;;
-J*) addJava "${1:2}" && shift ;;
*) addResidual "$1" && shift ;;
esac
done
Expand Down
18 changes: 14 additions & 4 deletions dist/bin/dotr
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ addJvmOptions () {
jvm_options+=("$1")
}

addDotcOptions () {
java_options+=("$1")
}

source "$PROG_HOME/bin/common"

declare -a residual_args
Expand All @@ -40,6 +44,12 @@ with_compiler=false
class_path_count=0
CLASS_PATH=""

# Little hack to check if all arguments are options
all_params="$*"
truncated_params="${*#-}"
# options_indicator != 0 if at least one parameter is not an option
options_indicator=$(( ${#all_params} - ${#truncated_params} - $# ))

while [[ $# -gt 0 ]]; do
case "$1" in
-repl)
Expand All @@ -65,7 +75,8 @@ while [[ $# -gt 0 ]]; do
shift
;;
-J*)
addJvmOptions "-${1:2}"
addJvmOptions "${1:2}"
addDotcOptions "${1}"
shift ;;
*)
residual_args+=("$1")
Expand All @@ -74,13 +85,12 @@ while [[ $# -gt 0 ]]; do

esac
done

if [ $execute_repl == true ] || ([ $execute_run == false ] && [ ${#residual_args[@]} -eq 0 ]); then
if [ $execute_repl == true ] || ([ $execute_run == false ] && [ $options_indicator == 0 ]); then
if [ "$CLASS_PATH" ]; then
cp_arg="-classpath \"$CLASS_PATH\""
fi
echo "Starting dotty REPL..."
eval "\"$PROG_HOME/bin/dotc\" $cp_arg -repl ${residual_args[@]}"
eval "\"$PROG_HOME/bin/dotc\" $cp_arg ${java_options[@]} -repl ${residual_args[@]}"
elif [ $execute_repl == true ] || [ ${#residual_args[@]} -ne 0 ]; then
cp_arg="$DOTTY_LIB$PSEP$SCALA_LIB"
if [ -z "$CLASS_PATH" ]; then
Expand Down