From 0280306d7fb9e78a57f5e1c4848bfbbbba3847d9 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 19 Dec 2012 15:59:07 +0100 Subject: [PATCH 1/6] Add SBT build, .gitignore. --- build.sbt | 13 +++++++++++++ gitignore.SAMPLE | 5 +++++ project/build.properties | 1 + project/plugins.sbt | 3 +++ 4 files changed, 22 insertions(+) create mode 100644 build.sbt create mode 100644 gitignore.SAMPLE create mode 100644 project/build.properties create mode 100644 project/plugins.sbt diff --git a/build.sbt b/build.sbt new file mode 100644 index 000000000000..8e84bd19c73e --- /dev/null +++ b/build.sbt @@ -0,0 +1,13 @@ +name := "dotty" + +organization := "lamp" + +scalaVersion := "2.10.0" + +scalaSource in Compile <<= baseDirectory / "src" + +scalacOptions in Global ++= Seq("-feature", "-deprecation", "-language:_") + +libraryDependencies <+= scalaVersion ( sv => "org.scala-lang" % "scala-reflect" % sv ) + +scalaSource in Test <<= baseDirectory / "test" \ No newline at end of file diff --git a/gitignore.SAMPLE b/gitignore.SAMPLE new file mode 100644 index 000000000000..189e089d438e --- /dev/null +++ b/gitignore.SAMPLE @@ -0,0 +1,5 @@ +.idea +.idea_modules +.gitignore +target +project/local-plugins.sbt diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 000000000000..66ad72ce2eba --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=0.12.2 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 000000000000..b6864b47bbbc --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,3 @@ +// Add personal SBT plugins for IDEs, etc to `local-plugins.sbt` +// +// e.g. addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.1.0") From 4eb61cd80ff04ac24b2826193eb0b535de864cd3 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 10 Feb 2013 15:00:40 +0100 Subject: [PATCH 2/6] Add .gitattributes for CRLF avoidance --- .gitattributes | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000000..d9d8b125c878 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,26 @@ +# These files are text and should be normalized (convert crlf => lf) +*.c text +*.check text +*.css text +*.html text +*.java text +*.js text +*.sbt text +*.scala text +*.sh text +*.txt text +*.xml text + +# Windows-specific files get windows endings +*.bat eol=crlf +*.cmd eol=crlf +*-windows.tmpl eol=crlf + +# Some binary file types for completeness +# (binary is a macro for -text -diff) +*.dll binary +*.gif binary +*.jpg binary +*.png binary +*.class binary +*.jar binary \ No newline at end of file From 923da638435d3a660db076f23df0eeb64f75d186 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 10 Feb 2013 14:07:23 +0100 Subject: [PATCH 3/6] Fix Settings#value. It was returning the entire settings buffer, rather than a single entry. --- src/dotty/tools/dotc/config/Settings.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dotty/tools/dotc/config/Settings.scala b/src/dotty/tools/dotc/config/Settings.scala index eff9c245f5c0..bbd6aae80c5d 100644 --- a/src/dotty/tools/dotc/config/Settings.scala +++ b/src/dotty/tools/dotc/config/Settings.scala @@ -18,9 +18,9 @@ object Settings { private var values = ArrayBuffer(initialValues: _*) private var _wasRead: Boolean = false - def value(idx: Int) = { + def value(idx: Int): Any = { _wasRead = true - values + values(idx) } def update(idx: Int, x: Any): SettingsState = From 0ead5e864c158800d4dd7b26d469d44ae1d272b1 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 10 Feb 2013 14:08:12 +0100 Subject: [PATCH 4/6] Make NoContext#base a def. As it throws an unsupported error. --- src/dotty/tools/dotc/core/Contexts.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index c4c9e7764d78..451d8edd3339 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -137,7 +137,7 @@ object Contexts { } object NoContext extends Context { - val base = unsupported("base") + def base = unsupported("base") } class ContextBase extends ContextState with Transformers.TransformerBase From e098f4cd0fe2dbe943ef35655f22d4d57cf233a8 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 10 Feb 2013 14:09:41 +0100 Subject: [PATCH 5/6] Break initialization cycle in Transformers. --- src/dotty/tools/dotc/core/Transformers.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dotty/tools/dotc/core/Transformers.scala b/src/dotty/tools/dotc/core/Transformers.scala index a87356f3991b..342994c47edf 100644 --- a/src/dotty/tools/dotc/core/Transformers.scala +++ b/src/dotty/tools/dotc/core/Transformers.scala @@ -6,7 +6,7 @@ import java.lang.AssertionError trait Transformers -object Transformers { +object Transformers { transSelf => trait TransformerBase { self: ContextBase => @@ -32,7 +32,8 @@ object Transformers { } object NoTransformer extends Transformer { - val phaseId = lastPhaseId + 1 + val phaseId = transSelf.lastPhaseId + 1 + override def lastPhaseId = phaseId - 1 // TODO JZ Probably off-by-N error here. def transform(ref: SingleDenotation)(implicit ctx: Context): SingleDenotation = unsupported("transform") } From 159bf9dccf1bc5c835d9af2b067b457187de7169 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 10 Feb 2013 14:53:33 +0100 Subject: [PATCH 6/6] Fix apparent cut-n-pasto in Type#mapOr --- src/dotty/tools/dotc/core/Types.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index aca1aef1d8a5..cdf01c009cf9 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -243,7 +243,7 @@ object Types { /** Map function over elements of an OrType, rebuilding with | */ def mapOr(f: Type => Type)(implicit ctx: Context): Type = this match { - case OrType(tp1, tp2) => tp1.mapAnd(f) | tp2.mapAnd(f) + case OrType(tp1, tp2) => tp1.mapOr(f) | tp2.mapOr(f) case _ => f(this) }