diff options
author | Martin Odersky <odersky@gmail.com> | 2003-02-14 13:38:50 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2003-02-14 13:38:50 +0000 |
commit | fd3f10df3cd88fe3b970f8312a479ae63f0803b8 (patch) | |
tree | 4417d42a8b7a1a326c1eab8dcb867a9de7c90659 | |
parent | 23d2bfbeb21f63d82ed46d5b1b0b85b1ed2f4355 (diff) | |
download | scala-fd3f10df3cd88fe3b970f8312a479ae63f0803b8.tar.gz scala-fd3f10df3cd88fe3b970f8312a479ae63f0803b8.tar.bz2 scala-fd3f10df3cd88fe3b970f8312a479ae63f0803b8.zip |
*** empty log message ***
-rwxr-xr-x | bin/makescalac | 2 | ||||
-rw-r--r-- | sources/scalac/Makefile | 601 | ||||
-rw-r--r-- | sources/scalac/ast/printer/TextTreePrinter.java | 4 | ||||
-rw-r--r-- | sources/scalac/symtab/Type.java | 8 | ||||
-rw-r--r-- | sources/scalac/transformer/LambdaLift.java | 4 | ||||
-rw-r--r-- | sources/scalac/transformer/LambdaLiftPhase.java | 1 | ||||
-rw-r--r-- | sources/scalac/typechecker/Analyzer.java | 6 |
7 files changed, 615 insertions, 11 deletions
diff --git a/bin/makescalac b/bin/makescalac new file mode 100755 index 0000000000..6224498207 --- /dev/null +++ b/bin/makescalac @@ -0,0 +1,2 @@ +#needs to be run in scalac directory. +pico -d $HOME/classes -source 1.4 *.java */*.java ast/printer/*.java symtab/classfile/*.java diff --git a/sources/scalac/Makefile b/sources/scalac/Makefile new file mode 100644 index 0000000000..1c26a9e771 --- /dev/null +++ b/sources/scalac/Makefile @@ -0,0 +1,601 @@ +# Makefile for the Scala compiler. Needs GNU Make. +# $Id$ + +# Main targets: +# all (default) +# Recompile every file that was modified after the latest +# compilation ended. The date of the latest compilation end is +# remembered through the files .latest-(compiler|runtime). +# util +# Recompile only utility files, used by the compiler. +# compiler +# Recompile only files which belong to the compiler. +# runtime +# Recompile only files which belong to the run-time. +# regtest +# Perform regression testing. +# force +# Recompile everything, no matter when source files were modified. +# clean +# Remove everything in the $(PROJECT_GENDIR)/scala directory. + +# There are also targets to run grep on all files and to count the +# number of lines. + +# Directory in which .class files should be put. +# BEWARE! The whole contents of the "scala" subdirectory in this +# directory is wiped out by a "make clean" so don't put anything else +# than automatically-generated .class files there. + + +############################################################################## +# Variables +############################################################################## + +# makefile + +ROOT = . +MAKE_HOME = $(ROOT)/make + +# project + +PROJECT_NAME = scala +PROJECT_MAKEDIR = $(PROJECT_ROOT) +PROJECT_SOURCES += $(RUNTIME_SOURCES) +PROJECT_SOURCES += $(COMPILER_SOURCES) +PROJECT_SOURCES += $(INTERPRETER_SOURCES) +PROJECT_ROOT = $(ROOT) +PROJECT_GENDIR = $(PROJECT_ROOT)/classes +PROJECT_CLASSPATH = $(PROJECT_GENDIR) + +# BCEL (see http://jakarta.apache.org/bcel/) + +BCEL_HOME = /home/linuxsoft/apps/BCEL-5 +BCEL_JARFILE = $(BCEL_HOME)/bcel.jar +BCEL_LICENSE = $(BCEL_HOME)/LICENSE + +# needed for the .NET backend + +MSIL_HOME = /home/linuxsoft/apps/java2net +MSIL_JARFILE = $(MSIL_HOME)/msil.jar + +# grep + +GREP_ARGS ?= $(ARGS) + +# regression tests + +REGTEST = ./test/bin/scala-test +REGTEST_ARGS ?= $(ARGS) + +# scripts + +SCRIPTS_PREFIX = bin + +SCRIPTS_LINKED_NAMES += socos +SCRIPTS_LINKED_NAMES += socos-debug +SCRIPTS_LINKED_NAMES += surus +SCRIPTS_LINKED_NAMES += surus-debug +SCRIPTS_LINKED_NAMES += siris +SCRIPTS_LINKED_NAMES += siris-debug + +SCRIPTS_LINKED_FILES = $(SCRIPTS_LINKED_NAMES:%=$(SCRIPTS_PREFIX)/%) + +# automatic generation of Function<n>.java and Tuple<n>.scala files + +TEMPLATE_EXPANDER = ./bin/expand-template +TEMPLATE_DIR = ./sources/templates + +FUNCTION_FILES += $(filter ./sources/scala/Function%.java,$(PROJECT_SOURCES)) +FUNCTION_TEMPLATE = $(TEMPLATE_DIR)/Function.tmpl +FUNCTION_RULES = $(TEMPLATE_DIR)/Function.scm + +TUPLE_FILES += $(filter $(LIBRARY_DIR)/scala/Tuple%.scala,$(LIBRARY_FILES)) +TUPLE_TEMPLATE = $(TEMPLATE_DIR)/Tuple.tmpl +TUPLE_RULES = $(TEMPLATE_DIR)/Tuple.scm + +# scala runtime + +RUNTIME_SOURCES += $(call READLIST,Sources-runtime) +RUNTIME_JC_COMPILER += PICO + +# scala compiler + +COMPILER_SOURCES += $(call READLIST,Sources-compiler) +COMPILER_JC_COMPILER = PICO +COMPILER_JC_CLASSPATH = $(PROJECT_CLASSPATH):$(BCEL_JARFILE):$(MSIL_JARFILE) + +# scala interpreter + +INTERPRETER_SOURCES += $(call READLIST,Sources-interpreter) +INTERPRETER_JC_COMPILER = PICO + +# scala resources + +RESOURCE_MIRROR_FLAGS = -m 644 +RESOURCE_MIRROR_DSTDIR = $(PROJECT_GENDIR) +RESOURCE_MIRROR_SRCDIR = sources +RESOURCE_MIRROR_FILES += scala/compiler/jaco/resources/Messages.properties +RESOURCE_MIRROR_FILES += scala/compiler/jaco/resources/Settings.properties + +# scala library + +LIBRARY_DIR = $(PROJECT_ROOT)/scala-sources +LIBRARY_files += $(call READLIST, $(MAKE_HOME)/list/library.lst) +LIBRARY_FILES = $(LIBRARY_files:%=$(LIBRARY_DIR)/%) + +# scala examples + +EXAMPLES_DIR = $(PROJECT_ROOT)/examples +EXAMPLES_files += $(call READLIST, $(MAKE_HOME)/list/examples.lst) +EXAMPLES_FILES = $(EXAMPLES_files:%=$(EXAMPLES_DIR)/%) + +# scala prelude + +PRELUDE_DIR = $(LIBRARY_DIR)/prelude +PRELUDE_FILES += $(call READLIST,$(MAKE_HOME)/list/prelude.lst) +prelude_NAMES += $(notdir $(PRELUDE_FILES)) +prelude_LINKS += $(prelude_NAMES:%=$(PRELUDE_DIR)/%) + +# scala test + +TEST_DIR = $(PROJECT_ROOT)/test +TEST_files += $(call READLIST, $(MAKE_HOME)/list/test-pos.lst) +TEST_files += $(call READLIST, $(MAKE_HOME)/list/test-neg.lst) +TEST_files += $(call READLIST, $(MAKE_HOME)/list/test-int.lst) +TEST_FILES = $(TEST_files:%=$(TEST_DIR)/%) + +# emacs scala-mode + +EMACS_DIR = $(PROJECT_ROOT)/support/emacs +EMACS_files += $(call READLIST, $(MAKE_HOME)/list/emacs.lst) +EMACS_FILES = $(EMACS_files:%=$(EMACS_DIR)/%) + +# jar + +PROJECT_JAR_ARCHIVE = lib/$(PROJECT_NAME).jar +PROJECT_JAR_MANIFEST = sources/MANIFEST +PROJECT_JAR_INPUTDIR = $(PROJECT_GENDIR) +PROJECT_JAR_FILES += scala + +# java compilation + +JC_OUTPUTDIR = $(PROJECT_GENDIR) +JC_CLASSPATH = $(PROJECT_CLASSPATH) + +# Tools to use for the other targets. + +ECHO = echo +CAT = cat +JAR = jar +GREP = grep +FIND = find +WC = wc +SED = sed +M4 = m4 +RM = rm +CP = cp +LN = ln +MKDIR = mkdir +TOUCH = touch +CHMOD = chmod +DIRNAME = dirname +BASENAME = basename +DATE = date +NICE = nice +ZIP = zip +UNIX2DOS = unix2dos + +JAVAC = javac +JAVAC_FLAGS += + +PICO = pico +PICO_FLAGS += -make -source 1.4 + +# private + +RUN = echo $(1); $(1) || exit $$? +LOOKUP = $(if $($(source)_$(1)),$($(source)_$(1)),$($(1))) +MAKE += --no-print-directory + +ifeq ($(shell which bash),/usr/local/bin/bash) +BASH = /bin/bash +else +BASH = bash +endif + +READLIST = $(shell cat $(1) | grep -v "^\#") +DO_SCRIPT = $(MAKE_HOME)/scripts.bash +DO = @exec $(BASH) -c "source $(DO_SCRIPT)" $(1) +INSTALL = $(call DO,install) + +############################################################################## +# Commands +############################################################################## + +all : scripts +all : functions +all : runtime +all : compiler +all : interpreter +all : resources +all : library + +scripts : $(SCRIPTS_LINKED_FILES) +functions : $(FUNCTION_FILES) +runtime : .latest-runtime +compiler : .latest-compiler +interpreter : .latest-interpreter +resources : .latest-resources +library : .latest-library +jar : $(PROJECT_JAR_ARCHIVE) + +clean : + $(RM) -f .latest-resources + $(RM) -f .latest-runtime .latest-compiler .latest-interpreter + $(RM) -rf $(PROJECT_GENDIR)/scala + +distclean : + @$(MAKE) clean + $(RM) -f .latest-library .latest-prelude + $(RM) -f $(FUNCTION_FILES) + $(RM) -f $(TUPLE_FILES) + $(RM) -f $(prelude_LINKS) + $(RM) -f $(PROJECT_JAR_ARCHIVE) + $(RM) -f $(SCRIPTS_LINKED_FILES) + +force : + $(RM) -f .latest-resources + $(RM) -f .latest-runtime .latest-compiler .latest-interpreter + @$(MAKE) all + +wc : + @$(WC) $(PROJECT_SOURCES) + +grep : + @$(if $(GREP_ARGS), \ + $(GREP) $(GREP_ARGS) $(PROJECT_SOURCES), \ + echo "You should put the arguments for grep in the ARGS variable") + +regtest : + $(NICE) -10 $(REGTEST) $(REGTEST_ARGS) + +show-duplicates : + @rm -f check.tmp.log check.mkf.log + @for filename in $(PROJECT_SOURCES); do \ + echo $$filename | tr " " "\n" >> check.tmp.log; \ + done + @sort check.tmp.log > check.mkf.log + @uniq -d check.mkf.log + +show-missing : + @rm -f check.tmp.log check.mkf.log check.lst.log + @for filename in $(PROJECT_SOURCES); do \ + echo $$filename | tr " " "\n" >> check.tmp.log; \ + done + @sort check.tmp.log > check.mkf.log + @$(FIND) . -name "*.java" | sort > check.lst.log + @comm -1 -3 check.mkf.log check.lst.log + @rm -f check.tmp.log check.mkf.log check.lst.log + +.PHONY : all clean distclean force +.PHONY : scripts runtime compiler interpreter resources jar +.PHONY : wc grep regtest +.PHONY : show-duplicates show-missing + +############################################################################## +# Targets +############################################################################## + +.latest-runtime : $(RUNTIME_SOURCES) + @$(MAKE) .do-jc source=RUNTIME JC_FILES='$?' + touch $@ + +.latest-compiler : $(COMPILER_SOURCES) + @$(MAKE) .do-jc source=COMPILER JC_FILES='$?' + touch $@ + +.latest-interpreter : $(INTERPRETER_SOURCES) + @$(MAKE) .do-jc source=INTERPRETER JC_FILES='$?' + touch $@ + +.latest-resources : $(RESOURCE_MIRROR_SOURCES) + @$(MAKE) .do-mirror source=RESOURCE + touch $@ + +.latest-library : $(LIBRARY_FILES) + touch $@ + +############################################################################## +# Rules +############################################################################## + +.build-scripts: $(SCRIPTS_LINKED_FILES) + +$(SCRIPTS_LINKED_FILES): + $(LN) -s .scala_wrapper $@; + +$(FUNCTION_FILES): $(FUNCTION_TEMPLATE) $(FUNCTION_RULES) + $(TEMPLATE_EXPANDER) $(FUNCTION_RULES) $(FUNCTION_TEMPLATE) $@ + +$(TUPLE_FILES): $(TUPLE_TEMPLATE) $(TUPLE_RULES) + $(TEMPLATE_EXPANDER) $(TUPLE_RULES) $(TUPLE_TEMPLATE) $@ + +$(PROJECT_JAR_ARCHIVE) : .latest-runtime +$(PROJECT_JAR_ARCHIVE) : .latest-compiler +$(PROJECT_JAR_ARCHIVE) : .latest-interpreter +$(PROJECT_JAR_ARCHIVE) : .latest-resources + @$(MAKE) .do-jar source=PROJECT + +############################################################################## +# JC - compile java files +############################################################################## +# +# JC_COMPILER = compiler name, for example JAVAC or PICO +# $(JC_COMPILER) = compiler command +# $(JC_COMPILER)_FLAGS = compiler-specific compilation flags +# JC_FLAGS += compilation flags +# JC_OUTPUTDIR = directory for the generated class files +# JC_CLASSPATH = class path +# JC_FILES += files to compile +# +############################################################################## + +# setup default values + +JC_COMPILER ?= JAVAC +JAVAC ?= javac + +# lookup actual values + +JC_COMPILER := $(call LOOKUP,JC_COMPILER) +JC_compiler := $(call LOOKUP,$(JC_COMPILER)) +JC_compiler_flags := $(call LOOKUP,$(JC_COMPILER)_FLAGS) +JC_FLAGS := $(call LOOKUP,JC_FLAGS) +JC_OUTPUTDIR := $(call LOOKUP,JC_OUTPUTDIR) +JC_CLASSPATH := $(call LOOKUP,JC_CLASSPATH) +JC_FILES := $(call LOOKUP,JC_FILES) + +# rules + +.do-jc: + @if [ -n "$(JC_OUTPUTDIR)" -a ! -d "$(JC_OUTPUTDIR)" ]; then \ + $(call RUN,$(INSTALL) -m 755 -d "$(JC_OUTPUTDIR)"); \ + fi + $(strip $(JC_compiler) $(JC_compiler_flags) $(JC_FLAGS) \ + $(JC_OUTPUTDIR:%=-d %) $(JC_CLASSPATH:%=-classpath %) \ + $(JC_FILES)) + +############################################################################## +# JAR - build java archive +############################################################################## +# +# JAR = archive command +# JAR_FLAGS += archive flags +# JAR_ARCHIVE = archive file +# JAR_MANIFEST = manifest file +# JAR_INPUTDIR = directory containing the files to archive +# JAR_FILES += files to store (relative to JAR_INPUTDIR) +# +############################################################################## + +# setup default values + +JAR ?= jar +JAR_FLAGS ?= v + +# lookup actual values + +JAR := $(call LOOKUP,JAR) +JAR_FLAGS := $(call LOOKUP,JAR_FLAGS) +JAR_ARCHIVE := $(call LOOKUP,JAR_ARCHIVE) +JAR_MANIFEST := $(call LOOKUP,JAR_MANIFEST) +JAR_INPUTDIR := $(call LOOKUP,JAR_INPUTDIR) +JAR_FILES := $(call LOOKUP,JAR_FILES) + +# rules + +.do-jar: + $(strip $(JAR) c$(JAR_FLAGS)f$(JAR_MANIFEST:%=m) $(JAR_ARCHIVE) \ + $(JAR_MANIFEST) $(JAR_INPUTDIR:%=-C %) $(JAR_FILES)) + +############################################################################## +# MIRROR - mirror files +############################################################################## +# +# MIRROR = mirror command +# MIRROR_FLAGS += mirror flags +# MIRROR_DSTDIR = directory in which the files are to be mirrored +# MIRROR_SRCDIR = directory containing the files to mirror +# MIRROR_FILES += files to mirror +# +############################################################################## + +# setup default values + +MIRROR ?= $(call DO,mirror) + +# lookup actual values + +MIRROR := $(call LOOKUP,MIRROR) +MIRROR_FLAGS := $(call LOOKUP,MIRROR_FLAGS) +MIRROR_DSTDIR := $(call LOOKUP,MIRROR_DSTDIR) +MIRROR_SRCDIR := $(call LOOKUP,MIRROR_SRCDIR) +MIRROR_FILES := $(call LOOKUP,MIRROR_FILES) + +# rules + +.do-mirror: + $(strip $(MIRROR) $(MIRROR_FLAGS) $(MIRROR_SRCDIR:%=-C %) \ + $(MIRROR_FILES) $(MIRROR_DSTDIR)) + +############################################################################## +############################################################################## + +############################################################################## +# beta versions +############################################################################## + +INSTALL_VERSION = install-test +INSTALL_PREFIX = $(ROOT)/distribs/scala-test +INSTALL_BINDIR = $(INSTALL_PREFIX)/bin +INSTALL_LIBDIR = $(INSTALL_PREFIX)/lib +INSTALL_DATADIR = $(INSTALL_PREFIX)/share +INSTALL_DATADIR_ROOT = $(INSTALL_DATADIR)/$(PROJECT_NAME) +INSTALL_DATADIR_LIBRARY = $(INSTALL_DATADIR_ROOT)/library +INSTALL_DATADIR_EXAMPLES = $(INSTALL_DATADIR_ROOT)/examples +INSTALL_DATADIR_TEST = $(INSTALL_DATADIR_ROOT)/test +INSTALL_DATADIR_EMACS = $(INSTALL_DATADIR)/emacs/site-lisp + +install-unix : $(PROJECT_JAR_ARCHIVE) + $(INSTALL) -m 755 -d $(INSTALL_PREFIX) + $(INSTALL) -m 755 -d $(INSTALL_BINDIR) + $(INSTALL) -m 755 ./bin/.scala_wrapper $(INSTALL_BINDIR) + @$(MAKE) SCRIPTS_PREFIX=$(INSTALL_BINDIR) .build-scripts + $(INSTALL) -m 755 -d $(INSTALL_LIBDIR) + $(INSTALL) -m 644 $(PROJECT_JAR_ARCHIVE) $(INSTALL_LIBDIR) + $(INSTALL) -m 644 $(BCEL_LICENSE) $(INSTALL_LIBDIR)/bcel.LICENSE + $(INSTALL) -m 644 $(BCEL_JARFILE) $(INSTALL_LIBDIR)/bcel.jar + $(INSTALL) -m 755 -d $(INSTALL_DATADIR) + $(INSTALL) -m 755 -d $(INSTALL_DATADIR_ROOT) + $(INSTALL) -m 755 -d $(INSTALL_DATADIR_LIBRARY) + $(strip $(MIRROR) -m 644 -C $(LIBRARY_DIR) $(LIBRARY_files) \ + $(INSTALL_DATADIR_LIBRARY)) + $(INSTALL) -m 755 -d $(INSTALL_DATADIR_EXAMPLES) + $(strip $(MIRROR) -m 644 -C $(EXAMPLES_DIR) $(EXAMPLES_files) \ + $(INSTALL_DATADIR_EXAMPLES)) + $(INSTALL) -m 755 -d $(INSTALL_DATADIR)/$(PROJECT_NAME)/test + $(INSTALL) -m 755 -d $(INSTALL_DATADIR)/$(PROJECT_NAME)/test/bin + $(INSTALL) -m 755 ./test/bin/scala-test $(INSTALL_DATADIR_TEST)/bin + $(strip $(MIRROR) -m 644 -C $(TEST_DIR) $(TEST_files) \ + $(INSTALL_DATADIR_TEST)) + $(strip $(MIRROR) -m 644 -C $(TEST_DIR) \ + $(shell cd $(TEST_DIR); ls $(TEST_files:%.scala=%.check) 2>/dev/null) \ + $(INSTALL_DATADIR_TEST)) + $(strip $(MIRROR) -m 644 -C $(TEST_DIR) \ + $(shell cd $(TEST_DIR); ls $(TEST_files:%.scala=%.flags) 2>/dev/null) \ + $(INSTALL_DATADIR_TEST)) + $(INSTALL) -m 755 -d $(INSTALL_DATADIR_EMACS) + $(strip $(MIRROR) -m 644 -C $(EMACS_DIR) $(EMACS_files) \ + $(INSTALL_DATADIR_EMACS)) + $(INSTALL) -m 644 ./README $(INSTALL_PREFIX) + $(ECHO) $(INSTALL_VERSION) > $(INSTALL_PREFIX)/VERSION + $(CHMOD) 644 $(INSTALL_PREFIX)/VERSION + +install-windows : + @if [ ! -d "$(INSTALL_PREFIX)" ]; then \ + echo "Could not find UNIX install '$(INSTALL_PREFIX)'"; \ + exit 1; \ + fi + $(UNIX2DOS) $(INSTALL_PREFIX)/README + $(UNIX2DOS) $(INSTALL_PREFIX)/VERSION + $(UNIX2DOS) $(INSTALL_LIBDIR)/bcel.LICENSE + $(TOUCH) $(INSTALL_PREFIX)/VERSION-$(INSTALL_VERSION) + @root=`cd "$(INSTALL_PREFIX)"; pwd`; \ + for file in "" $(SCRIPTS_LINKED_NAMES); do \ + if [ -z "$$file" ]; then continue; fi; \ + echo -n "Generating $$file.bat ... "; \ + srcfile="$(ROOT)/support/windows/scala_wrapper"; \ + nixfile="$(INSTALL_PREFIX)/bin/$$file"; \ + winfile="$(INSTALL_PREFIX)/bin/$$file.bat"; \ + nixexec=`SCALA_WRAPPER_EXEC=echo $$nixfile`; \ + winexec="$$nixexec"; \ + winexec=`echo "$$winexec" | sed -es"#$$root#%SCALA_HOME%#g"`; \ + winexec=`echo "$$winexec" | tr '/' '\\\\' | tr ':' ';'`; \ + $(RM) -f "$$winfile"; \ + ( \ + $(CAT) "$$srcfile-header.bat"; \ + $(ECHO) "set VERSION=$(INSTALL_VERSION)"; \ + $(ECHO) "set COMMAND=$$winexec"; \ + $(CAT) "$$srcfile-footer.bat"; \ + ) | $(UNIX2DOS) >> "$$winfile"; \ + $(RM) "$$nixfile"; \ + echo "done"; \ + done + $(RM) $(INSTALL_PREFIX)/bin/.scala_wrapper + $(FIND) $(INSTALL_DATADIR_LIBRARY) -type f -exec unix2dos "{}" ";" + $(FIND) $(INSTALL_DATADIR_EXAMPLES) -type f -exec unix2dos "{}" ";" + $(FIND) $(INSTALL_DATADIR_TEST) -type f -exec unix2dos "{}" ";" + $(FIND) $(INSTALL_DATADIR_EMACS) -type f -exec unix2dos "{}" ";" + +############################################################################## + +DISTRIB_REPOSITORY = $(ROOT)/distribs +DISTRIB_VERSION := $(shell $(DATE) --utc "+%Y%m%d-%H%M%S") +DISTRIB_NAME = $(PROJECT_NAME)-$(DISTRIB_VERSION) +DISTRIB_PREFIX = $(DISTRIB_REPOSITORY)/$(DISTRIB_NAME) +DISTRIB_ARCHIVE = $(DISTRIB_REPOSITORY)/$(DISTRIB_NAME).tar.gz + +distrib-extract : + @if [ ! -f "$(DISTRIB_ARCHIVE)" ]; then \ + echo "Could not find source archive '$(DISTRIB_ARCHIVE)'"; \ + exit 1; \ + fi + @if [ -d "$(DISTRIB_PREFIX)" ]; then \ + $(call RUN,$(RM) -rf $(DISTRIB_PREFIX)); \ + fi + tar xvzf $(DISTRIB_ARCHIVE) -C $(DISTRIB_REPOSITORY) + +distrib-build-unix : + @$(MAKE) INSTALL_PREFIX=$(DISTRIB_PREFIX) \ + INSTALL_VERSION=$(DISTRIB_VERSION) install-unix + tar cvzf $(DISTRIB_ARCHIVE) -C $(DISTRIB_REPOSITORY) $(DISTRIB_NAME) + +distrib-build-windows : + @$(MAKE) INSTALL_PREFIX=$(DISTRIB_PREFIX) \ + INSTALL_VERSION=$(DISTRIB_VERSION) install-windows + $(RM) -f $(DISTRIB_PREFIX).zip + cd $(DISTRIB_REPOSITORY); $(ZIP) -r $(DISTRIB_NAME).zip $(DISTRIB_NAME) + +distrib-clean : + $(RM) -rf $(DISTRIB_PREFIX) + +distrib-unix : distrib-build-unix +distrib-unix : distrib-clean + +distrib-windows : DISTRIB_NAME=$(notdir $(ARGS:%.tar.gz=%)) +distrib-windows : DISTRIB_VERSION=$(DISTRIB_NAME:scala-%=%) +distrib-windows : distrib-extract +distrib-windows : distrib-build-windows +distrib-windows : distrib-clean + +distrib-all-oses : distrib-build-unix +distrib-all-oses : distrib-build-windows +distrib-all-oses : distrib-clean + +distrib-14 : + @if [ -f "$(ROOT)/bin/.scala_wrapper.bak" ]; then \ + echo "There is a backup of .scala_wrapper, maybe you should run: "; \ + echo "make distrib-13-undo"; \ + exit 1; \ + fi + @$(MAKE) distrib-all-oses DISTRIB_VERSION=$(DISTRIB_VERSION); + +distrib-13-undo : + @$(MAKE) clean; + mv $(ROOT)/bin/.scala_wrapper.bak $(ROOT)/bin/.scala_wrapper + +#distrib-13 : PATH:=/home/linuxsoft/apps/java-1.3/bin:$(PATH) +distrib-13 : + @if [ -f "$(ROOT)/bin/.scala_wrapper.bak" ]; then \ + echo "Cannot save .scala_wrapper, there is already a backup," \ + "maybe you should run: "; \ + echo "make distrib-13-undo"; \ + exit 1; \ + fi + mv $(ROOT)/bin/.scala_wrapper $(ROOT)/bin/.scala_wrapper.bak + $(SED) -e "s/-enableassertions//" $(ROOT)/bin/.scala_wrapper.bak \ + > $(ROOT)/bin/.scala_wrapper + @$(MAKE) clean; + @$(MAKE) COMPILER_JC_FLAGS="$(COMPILER_JC_FLAGS) -target 1.3" + @$(MAKE) distrib-all-oses DISTRIB_VERSION=$(DISTRIB_VERSION)-jdk-1.3; + @$(MAKE) distrib-13-undo; + +distrib : distrib-14 +distrib : distrib-13 + +.PHONY : install-unix install-windows +.PHONY : distrib-extract distrib-build-unix distrib-build-windows +.PHONY : distrib-unix distrib-windows distrib + +############################################################################## diff --git a/sources/scalac/ast/printer/TextTreePrinter.java b/sources/scalac/ast/printer/TextTreePrinter.java index c5138d025f..6cb7ac368c 100644 --- a/sources/scalac/ast/printer/TextTreePrinter.java +++ b/sources/scalac/ast/printer/TextTreePrinter.java @@ -313,7 +313,7 @@ public class TextTreePrinter implements TreePrinter { print(Text.Space); printSymbolDefinition(tree.symbol(), name); printParams(tparams); - if ((mods & Modifiers.ABSTRACT) != 0) printOpt(TXT_SUBTYPE, rhs, true); + if ((mods & (Modifiers.ABSTRACT | Modifiers.PARAM)) != 0) printOpt(TXT_SUBTYPE, rhs, true); else printOpt(TXT_EQUAL, rhs, true); break; @@ -667,7 +667,7 @@ public class TextTreePrinter implements TreePrinter { case TypeDef(int mods, Name name, _, Tree bound): printModifiers(mods); printSymbolDefinition(tree.symbol(), name); - printOpt(KW_EXTENDS, bound, true); + printOpt(TXT_SUBTYPE, bound, true); break; case ValDef(int mods, Name name, Tree tpe, Tree.Empty): diff --git a/sources/scalac/symtab/Type.java b/sources/scalac/symtab/Type.java index 3ec37799f4..e9d2e93864 100644 --- a/sources/scalac/symtab/Type.java +++ b/sources/scalac/symtab/Type.java @@ -578,8 +578,9 @@ public class Type implements Modifiers, Kinds, TypeTags { return tp; } else { Scope members2 = new Scope(); - Type tp1 = (tp.symbol().isCompoundSym()) ? compoundType(parts1, members2) - : compoundType(parts1, members2, tp.symbol()); + Type tp1 = compoundType(parts1, members2); + //Type tp1 = (tp.symbol().isCompoundSym()) ? compoundType(parts1, members2) + // : compoundType(parts1, members2, tp.symbol()); Symbol[] syms1 = members1.elements(); Symbol[] syms2 = new Symbol[syms1.length]; for (int i = 0; i < syms2.length; i++) { @@ -886,7 +887,6 @@ public class Type implements Modifiers, Kinds, TypeTags { private Type memberTransform(Symbol sym, Type tp) { Type tp1 = tp.asSeenFrom(narrow(), sym.owner()); Type tp2 = tp1.asSeenFrom(this, widen().symbol()); - //todo: sym.owner()? //if (Global.instance.debug) System.out.println(this + "/" + widen() + ".memberType(" + sym + ":" + tp + ") = " + tp1 + "/" + tp2);//DEBUG return tp2; } @@ -2054,7 +2054,7 @@ public class Type implements Modifiers, Kinds, TypeTags { boolean first = true; for (Scope.SymbolIterator it = members.iterator(); it.hasNext(); ) { Symbol sym = it.next(); - buf.append(first ? "{" : ", "); + buf.append(first ? " with {" : ", "); first = false; buf.append(sym.defString()); } diff --git a/sources/scalac/transformer/LambdaLift.java b/sources/scalac/transformer/LambdaLift.java index 56cc92e6de..ca37e43996 100644 --- a/sources/scalac/transformer/LambdaLift.java +++ b/sources/scalac/transformer/LambdaLift.java @@ -183,7 +183,7 @@ public class LambdaLift extends OwnerTransformer }; public Tree transform(Tree tree) { - global.debugPrinter.print("free ").print(tree).println().end();//debug + //global.debugPrinter.print("free ").print(tree).println().end();//DEBUG traverseTypeMap.apply(tree.type.widen()); Symbol sym = tree.symbol(); switch(tree) { @@ -287,7 +287,7 @@ public class LambdaLift extends OwnerTransformer } public Tree transform(Tree tree) { - global.debugPrinter.print("lifting ").print(tree).println().end();//debug + //global.debugPrinter.print("lifting ").print(tree).println().end();//DEBUG tree.type = descr.transform(tree.type, currentOwner); switch (tree) { case ClassDef(int mods, Name name, TypeDef[] tparams, ValDef[][] vparams, Tree tpe, Template impl): diff --git a/sources/scalac/transformer/LambdaLiftPhase.java b/sources/scalac/transformer/LambdaLiftPhase.java index 31d9eea2a8..d3ca99b43d 100644 --- a/sources/scalac/transformer/LambdaLiftPhase.java +++ b/sources/scalac/transformer/LambdaLiftPhase.java @@ -64,7 +64,6 @@ public class LambdaLiftPhase extends PhaseDescriptor implements Kinds, Modifiers switch (pre) { case ThisType(_): if (sym.constructor().isUpdated(nextPhase)) { - System.out.println("updated: " + sym.constructor());//debug Symbol[] tparams = sym.constructor().infoAt(nextPhase).typeParams(); int i = tparams.length; diff --git a/sources/scalac/typechecker/Analyzer.java b/sources/scalac/typechecker/Analyzer.java index 5558239d1c..9442110dfd 100644 --- a/sources/scalac/typechecker/Analyzer.java +++ b/sources/scalac/typechecker/Analyzer.java @@ -617,6 +617,7 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { case ClassDef(int mods, Name name, Tree.TypeDef[] tparams, Tree.ValDef[][] vparams, _, Tree.Template templ): ClassSymbol clazz = new ClassSymbol(tree.pos, name, owner, mods); if (clazz.isLocalClass()) unit.mangler.setMangledName(clazz); + enterSym(tree, clazz.constructor()); if ((mods & CASE) != 0) { // enter case constructor method. @@ -1045,6 +1046,7 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { if (sym.isTerm() && (sym.flags & MUTABLE) == 0 && symtype.isObjectType() && qual.type.isStable()) symtype = Type.singleType(qual.type, sym); + //System.out.println(qual.type + ".member: " + sym + ":" + symtype);//DEBUG return copy.Select(tree, qual, name) .setSymbol(sym).setType(symtype); } @@ -1658,8 +1660,8 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { Scope.SymbolIterator it = clazz.members().iterator(); while (it.hasNext()) { Symbol sym1 = it.next(); - if (base.lookupNonPrivate(sym1.name).kind != NONE && - !base.memberType(sym1).isSameAs(sym1.type())) + Symbol basesym1 = base.lookupNonPrivate(sym1.name); + if (basesym1.kind != NONE && !basesym1.info().isSameAs(sym1.info())) refinement.enter(sym1); } if (refinement.elems == Scope.Entry.NONE && |