Skip to content
This repository was archived by the owner on Sep 1, 2020. It is now read-only.

Add an @implicitAmbiguous annotation #32

Merged
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
1 change: 1 addition & 0 deletions build-ant-macros.xml
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@

<sequential>
<deploy-one name="scala-library" local="@{local}" signed="@{signed}"/>
<deploy-one name="scala-typelevel" local="@{local}" signed="@{signed}"/>
<deploy-one name="scala-reflect" local="@{local}" signed="@{signed}"/>
<deploy-one name="scala-compiler" local="@{local}" signed="@{signed}"/>

Expand Down
50 changes: 46 additions & 4 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ TODO:
<path refid="external-modules.deps.classpath"/>
<rsel:not><rsel:or>
<rsel:name name="scala-library*.jar"/>
<rsel:name name="scala-typelevel*.jar"/>
<rsel:name name="scala-reflect*.jar"/>
<rsel:name name="scala-compiler*.jar"/>
</rsel:or></rsel:not>
Expand Down Expand Up @@ -650,7 +651,7 @@ TODO:
<property name="partest-javaagent.description" value="Scala Compiler Testing Tool (compiler-specific java agent)"/>

<!-- projects without project-specific options: asm, forkjoin, manual, bin, repl -->
<for list="actors,compiler,interactive,scaladoc,library,parser-combinators,partest,partest-extras,partest-javaagent,reflect,scalap,swing,xml,continuations-plugin,continuations-library" param="project">
<for list="actors,compiler,interactive,scaladoc,library,typelevel,parser-combinators,partest,partest-extras,partest-javaagent,reflect,scalap,swing,xml,continuations-plugin,continuations-library" param="project">
<sequential>
<!-- description is mandatory -->
<init-project-prop project="@{project}" name="package" default=""/> <!-- used by mvn-package, copy-bundle, make-bundle -->
Expand Down Expand Up @@ -732,6 +733,11 @@ TODO:
<path refid="aux.libs"/>
</path>

<path id="quick.typelevel.build.path">
<path refid="quick.library.build.path"/>
<pathelement location="${build-quick.dir}/classes/typelevel"/>
</path>

<path id="quick.actors.build.path">
<path refid="quick.library.build.path"/>
<pathelement location="${build-quick.dir}/classes/actors"/>
Expand Down Expand Up @@ -786,6 +792,7 @@ TODO:

<path id="quick.bin.tool.path">
<path refid="quick.repl.build.path"/>
<path refid="quick.typelevel.build.path"/>
<path refid="quick.actors.build.path"/>
<pathelement location="${build-quick.dir}/classes/scalap"/>
<pathelement location="${build-quick.dir}/classes/scaladoc"/>
Expand All @@ -795,6 +802,7 @@ TODO:
<!-- PACK -->
<path id="pack.compiler.path">
<pathelement location="${library.jar}"/>
<pathelement location="${typelevel.jar}"/>
<pathelement location="${reflect.jar}"/>
<pathelement location="${compiler.jar}"/>
<pathelement location="${ant.jar}"/>
Expand All @@ -804,6 +812,7 @@ TODO:

<path id="pack.bin.tool.path">
<pathelement location="${library.jar}"/>
<pathelement location="${typelevel.jar}"/>
<pathelement location="${xml.jar}"/>
<pathelement location="${parser-combinators.jar}"/>
<pathelement location="${actors.jar}"/>
Expand All @@ -820,6 +829,10 @@ TODO:
<fileset dir="${forkjoin-classes}"/>
</path>

<path id="pack.typelevel.files">
<fileset dir="${build-quick.dir}/classes/typelevel"/>
</path>

<path id="pack.actors.files">
<fileset dir="${build-quick.dir}/classes/actors"/>
</path>
Expand Down Expand Up @@ -866,6 +879,7 @@ TODO:

<!-- DOCS -->
<path id="docs.library.build.path"> <path refid="quick.library.build.path"/> </path>
<path id="docs.typelevel.build.path"> <path refid="quick.typelevel.build.path"/> </path>
<path id="docs.reflect.build.path"> <path refid="quick.reflect.build.path"/> </path>
<path id="docs.compiler.build.path"> <path refid="quick.compiler.build.path"/> </path>
<path id="docs.scaladoc.build.path"> <path refid="quick.scaladoc.build.path"/> </path>
Expand All @@ -877,6 +891,7 @@ TODO:
<path id="scaladoc.classpath">
<path refid="external-modules-nocore"/>
<pathelement location="${library.jar}"/>
<pathelement location="${typelevel.jar}"/>
<pathelement location="${reflect.jar}"/>
<pathelement location="${compiler.jar}"/>

Expand All @@ -892,6 +907,7 @@ TODO:
<path id="manual.build.path">
<path refid="external-modules-nocore"/> <!-- xml -->
<pathelement location="${library.jar}"/>
<pathelement location="${typelevel.jar}"/>
<pathelement location="${build.dir}/manmaker/classes"/>
<path refid="aux.libs"/> <!-- for ant -->
</path>
Expand All @@ -917,6 +933,7 @@ TODO:
</path>
<path id="partest.compilation.path.core">
<pathelement location="${library.jar}"/>
<pathelement location="${typelevel.jar}"/>
<pathelement location="${reflect.jar}"/>
<pathelement location="${compiler.jar}"/>
</path>
Expand All @@ -940,6 +957,7 @@ TODO:
<path refid="partest.classpath"/>
<rsel:not><rsel:or>
<rsel:name name="scala-library*.jar"/>
<rsel:name name="scala-typelevel*.jar"/>
</rsel:or></rsel:not>
</restrict>
<pathelement location="${scala-xml}"/>
Expand All @@ -950,6 +968,7 @@ TODO:
<path refid="scalacheck.classpath"/>
<rsel:not><rsel:or>
<rsel:name name="scala-library*.jar"/>
<rsel:name name="scala-typelevel*.jar"/>
<rsel:name name="scala-compiler*.jar"/>
<rsel:name name="scala-reflect*.jar"/>
<rsel:name name="scala-actors*.jar"/>
Expand All @@ -976,6 +995,7 @@ TODO:
<path id="test.osgi.compiler.build.path">
<pathelement location="${test.osgi.classes}"/>
<pathelement location="${build-osgi.dir}/org.scala-lang.scala-library.jar"/>
<pathelement location="${build-osgi.dir}/org.scala-lang.scala-typelevel.jar"/>
<pathelement location="${build-osgi.dir}/org.scala-lang.scala-reflect.jar"/>
<pathelement location="${build-osgi.dir}/org.scala-lang.scala-compiler.jar"/>
<pathelement location="${build-osgi.dir}/org.scala-lang.scala-actors.jar"/>
Expand Down Expand Up @@ -1090,6 +1110,9 @@ TODO:
<target name="quick.lib" depends="quick.start">
<staged-build with="locker" stage="quick" project="library" srcpath="${src.dir}/library" includes="lib.rootdoc.includes"/></target>

<target name="quick.typelevel" depends="quick.lib">
<staged-build with="locker" stage="quick" project="typelevel"/> </target>

<target name="quick.reflect" depends="quick.lib">
<staged-build with="locker" stage="quick" project="reflect"/> </target>

Expand Down Expand Up @@ -1128,6 +1151,8 @@ TODO:
============================================================================ -->
<target name="pack.lib" depends="quick.lib, forkjoin.done"> <staged-pack project="library"/></target>

<target name="pack.typelevel" depends="quick.typelevel"> <staged-pack project="typelevel"/></target>

<target name="pack.reflect" depends="quick.reflect"> <staged-pack project="reflect"/> </target>

<!-- TODO modularize compiler. Remove other quick targets when they become modules. -->
Expand All @@ -1147,7 +1172,7 @@ TODO:
<copy file="${basedir}/META-INF/MANIFEST.MF" toDir="${build-pack.dir}/META-INF"/>
<manifest file="${build-pack.dir}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Bundle-Version" value="${version.number}"/>
<attribute name="Class-Path" value="scala-reflect.jar scala-library.jar"/>
<attribute name="Class-Path" value="scala-reflect.jar scala-library.jar scala-typelevel.jar"/>
</manifest>
</pre>
<!-- JSR-223 support introduced in 2.11 -->
Expand All @@ -1166,7 +1191,7 @@ TODO:

<target name="pack.scalap" depends="quick.scalap"> <staged-pack project="scalap"/> </target>

<target name="pack.core" depends="pack.reflect, pack.comp, pack.lib"/>
<target name="pack.core" depends="pack.reflect, pack.comp, pack.lib, pack.typelevel"/>

<!-- TODO modularize compiler: pack.scaladoc, pack.interactive, -->
<target name="pack.modules" depends="pack.actors, pack.scalap">
Expand Down Expand Up @@ -1232,6 +1257,7 @@ TODO:
</fileset>
<filelist>
<file name="${library.jar}"/>
<file name="${typelevel.jar}"/>
<file name="${reflect.jar}"/>
<file name="${compiler.jar}"/>
</filelist>
Expand All @@ -1244,6 +1270,10 @@ TODO:
<fileset dir="${src.dir}/library"/>
</make-bundle>

<make-bundle project="typelevel">
<fileset dir="${src.dir}/typelevel"/>
</make-bundle>

<make-bundle project="reflect">
<fileset dir="${src.dir}/reflect"/>
</make-bundle>
Expand Down Expand Up @@ -1568,6 +1598,12 @@ TODO:
</staged-docs>
</target>

<target name="docs.typelevel" depends="docs.start" unless="docs.skip">
<staged-docs project="typelevel">
<include name="**/*.scala"/>
</staged-docs>
</target>

<target name="docs.reflect" depends="docs.start" unless="docs.skip">
<staged-docs project="reflect">
<include name="**/*.scala"/>
Expand Down Expand Up @@ -1611,7 +1647,7 @@ TODO:
</staged-docs>
</target>

<target name="docs.core" depends="docs.lib, docs.reflect, docs.comp" unless="docs.skip"/>
<target name="docs.core" depends="docs.lib, docs.typelevel, docs.reflect, docs.comp" unless="docs.skip"/>
<!-- TODO modularize compiler: docs.scaladoc, docs.interactive, -->
<target name="docs.done" depends="docs.core, docs.actors, docs.scalap" unless="docs.skip"/>

Expand Down Expand Up @@ -1667,6 +1703,7 @@ MAIN DISTRIBUTION PACKAGING
<mkdir dir="${dist.maven}"/>

<mvn-package project="library"/>
<mvn-package project="typelevel"/>
<mvn-package project="reflect"/>
<mvn-package project="compiler"/>

Expand Down Expand Up @@ -1731,30 +1768,35 @@ MAIN DISTRIBUTION PACKAGING
<target name="publish" depends="pack-maven.done, init.maven" description="Publishes unsigned artifacts to the maven repo.">
<deploy />
<deploy-pom name="scala-library-all"/>
<deploy-jar name="scala-typelevel"/>
<deploy-jar name="scala-dist"/>
</target>

<target name="publish.local" depends="pack-maven.done, init.maven" description="Publishes unsigned artifacts to the local maven repo.">
<deploy local="true"/>
<deploy-pom name="scala-library-all" local="true"/>
<deploy-jar name="scala-typelevel" local="true"/>
<deploy-jar name="scala-dist" local="true"/>
</target>

<target name="publish.signed" depends="pack-maven.done, init.maven" description="Publishes signed artifacts to the remote maven repo.">
<deploy signed="true"/>
<deploy-pom name="scala-library-all" signed="true"/>
<deploy-jar name="scala-typelevel" signed="true"/>
<deploy-jar name="scala-dist" signed="true"/>
</target>

<target name="publish-core" depends="pack-maven.core, init.maven">
<deploy-one name="scala-compiler" />
<deploy-one name="scala-library" />
<deploy-one name="scala-typelevel" />
<deploy-one name="scala-reflect" />
</target>

<target name="publish-core-local" depends="pack-maven.core, init.maven">
<deploy-one name="scala-compiler" local="true"/>
<deploy-one name="scala-library" local="true"/>
<deploy-one name="scala-typelevel" local="true"/>
<deploy-one name="scala-reflect" local="true"/>
</target>

Expand Down
7 changes: 7 additions & 0 deletions src/build/bnd/scala-typelevel.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bundle-Name: Scala Typelevel Library
Bundle-SymbolicName: org.scala-lang.scala-typelevel
ver: @VERSION@
Bundle-Version: ${ver}
Export-Package: *;version=${ver}
Import-Package: scala.*;version="${range;[==,=+);@VERSION@}",*
Bundle-RequiredExecutionEnvironment: JavaSE-1.6, JavaSE-1.7
5 changes: 5 additions & 0 deletions src/build/maven/scala-dist-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
<artifactId>scala-library-all</artifactId>
<version>@VERSION@</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-typelevel</artifactId>
<version>@VERSION@</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
Expand Down
47 changes: 47 additions & 0 deletions src/build/maven/scala-typelevel-pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-typelevel</artifactId>
<packaging>jar</packaging>
<version>@VERSION@</version>
<name>Scala Typelevel Library</name>
<description>Typelevel Library for the Typelevel Scala Compiler</description>
<url>http://typelevel.org/</url>
<inceptionYear>2014</inceptionYear>
<organization>
<name>Typelevel</name>
<url>http://typelevel.org/</url>
</organization>
<licenses>
<license>
<name>BSD 3-Clause</name>
<url>http://www.scala-lang.org/license.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<connection>scm:git:git://github.com/typelevel/scala.git</connection>
<url>https://github.com/typelevel/scala.git</url>
</scm>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/typelevel/scala/issues/</url>
</issueManagement>
<properties>
<info.apiURL>http://www.scala-lang.org/api/@VERSION@/</info.apiURL>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>@VERSION@</version>
</dependency>
</dependencies>
<developers>
<developer>
<id>typelevel</id>
<name>Typelevel</name>
</developer>
</developers>
</project>
19 changes: 15 additions & 4 deletions src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,8 @@ trait ContextErrors {

import definitions._

def AmbiguousImplicitError(info1: ImplicitInfo, info2: ImplicitInfo,
def AmbiguousImplicitError(info1: ImplicitInfo, tree1: Tree,
info2: ImplicitInfo, tree2: Tree,
pre1: String, pre2: String, trailer: String)
(isView: Boolean, pt: Type, tree: Tree)(implicit context0: Context) = {
if (!info1.tpe.isErroneous && !info2.tpe.isErroneous) {
Expand Down Expand Up @@ -1231,10 +1232,20 @@ trait ContextErrors {
if (explanation == "") "" else "\n" + explanation
)
}

def treeTypeArgs(annotatedTree: Tree) = annotatedTree match {
case TypeApply(_, args) => args.map(_.toString)
case _ => Nil
}

context.issueAmbiguousError(AmbiguousImplicitTypeError(tree,
if (isView) viewMsg
else s"ambiguous implicit values:\n${coreMsg}match expected type $pt")
)
(tree1.symbol, tree2.symbol) match {
case (ImplicitAmbiguousMsg(msg), _) => msg.format(treeTypeArgs(tree1))
case (_, ImplicitAmbiguousMsg(msg)) => msg.format(treeTypeArgs(tree2))
case (_, _) if isView => viewMsg
case (_, _) => s"ambiguous implicit values:\n${coreMsg}match expected type $pt"
}
))
}
}

Expand Down
Loading