Skip to content
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

Ammonite REPL confused by singleton types #280

Closed
tpolecat opened this Issue Nov 29, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@tpolecat
Copy link
Contributor

tpolecat commented Nov 29, 2015

Ammonite seems confused by shapeless's ability to conjure up singleton types, which makes extensible records and other things not work.

@ shapeless.Witness(1)
Compilation Failed
Main.scala:46: exception during macro expansion: 
scala.MatchError: Int(1) (of class scala.reflect.internal.Types$UniqueConstantType)
    at ammonite.repl.frontend.TPrintLowPri$.rec0$1(TPrintImpl.scala:144)
    at ammonite.repl.frontend.TPrintLowPri$.typePrintImpl(TPrintImpl.scala:181)

              .print(res0, res0, "res0", scala.None)
                    ^
@lihaoyi

This comment has been minimized.

Copy link
Owner

lihaoyi commented Jan 31, 2016

I cannot reproduce this either on master or on the last published version 0.5.2

haoyi-mbp:Ammonite haoyi$ sbt repl/test:run
[info] Loading global plugins from /Users/haoyi/.sbt/0.13/plugins
[info] Loading project definition from /Users/haoyi/Dropbox (Personal)/Workspace/Ammonite/project
[info] Set current project to ammonite (in build file:/Users/haoyi/Dropbox%20(Personal)/Workspace/Ammonite/)
[info] Running ammonite.repl.TestMain
Loading...
Welcome to the Ammonite Repl 0.5.3-SNAPSHOT
(Scala 2.11.7 Java 1.8.0_25)
@ load.ivy(
@ load.ivy("com.chuusai" %% "shapeless" % "2.1.0")
:: loading settings :: url = jar:file:/Users/haoyi/.ivy2/cache/org.apache.ivy/ivy/jars/ivy-2.4.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
:: resolving dependencies :: com.chuusai#shapeless_2.11-caller;working
    confs: [default]
    found com.chuusai#shapeless_2.11;2.1.0 in chain-resolver
    found org.scala-lang#scala-library;2.11.5 in chain-resolver
    found org.scala-lang#scala-compiler;2.11.5 in central
    found org.scala-lang#scala-reflect;2.11.5 in chain-resolver
    found org.scala-lang.modules#scala-xml_2.11;1.0.3 in chain-resolver
    found org.scala-lang.modules#scala-parser-combinators_2.11;1.0.3 in chain-resolver

:: problems summary ::
:::: ERRORS
    unknown resolver sbt-chain

    unknown resolver sbt-chain

    unknown resolver sbt-chain

    unknown resolver sbt-chain

    unknown resolver sbt-chain


:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS

@ shapeless.Witness(1)
res1: AnyRef with shapeless.Witness{type T = Int(1)} = cmd1$fresh$macro$1$1@78f3e63b
@ Bye!
[success] Total time: 54 s, completed Jan 30, 2016 4:46:56 PM
haoyi-mbp:Ammonite haoyi$ ~/amm
Loading...
Welcome to the Ammonite Repl 0.5.2
(Scala 2.11.7 Java 1.8.0_25)
haoyi-Ammonite@ load.ivy("com.chuusai" %% "shapeless" % "2.1.0")
:: loading settings :: url = jar:file:/Users/haoyi/amm!/org/apache/ivy/core/settings/ivysettings.xml
:: resolving dependencies :: com.chuusai#shapeless_2.11-caller;working
    confs: [default]
    found com.chuusai#shapeless_2.11;2.1.0 in chain-resolver
    found org.scala-lang#scala-library;2.11.5 in chain-resolver
    found org.scala-lang#scala-compiler;2.11.5 in central
    found org.scala-lang#scala-reflect;2.11.5 in chain-resolver
    found org.scala-lang.modules#scala-xml_2.11;1.0.3 in chain-resolver
    found org.scala-lang.modules#scala-parser-combinators_2.11;1.0.3 in chain-resolver

haoyi-Ammonite@ shapeless.Witness(1)
res1: AnyRef with shapeless.Witness{type T = Int(1)} = cmd1$fresh$macro$1$1@3020f22

@lihaoyi lihaoyi closed this Jan 31, 2016

@lihaoyi

This comment has been minimized.

Copy link
Owner

lihaoyi commented Jan 31, 2016

Feel free to ping back if you have a solid repro

@alexarchambault

This comment has been minimized.

Copy link
Collaborator

alexarchambault commented Jan 31, 2016

Here it is:

Welcome to the Ammonite Repl 0.5.2
(Scala 2.11.7 Java 1.8.0_60)
@ load.ivy("com.chuusai" %% "shapeless" % "2.2.5")

@ import shapeless.syntax.singleton._
import shapeless.syntax.singleton._
@ 2.narrow
Compilation Failed
Main.scala:66: exception during macro expansion:
scala.MatchError: Int(2) (of class scala.reflect.internal.Types$UniqueConstantType)
    at ammonite.repl.frontend.TPrintLowPri$.rec0$1(TPrintImpl.scala:144)
    at ammonite.repl.frontend.TPrintLowPri$.typePrintImpl(TPrintImpl.scala:181)

              .print(res2, res2, "res2", scala.None)
                    ^

@lihaoyi lihaoyi reopened this Jan 31, 2016

@lihaoyi lihaoyi closed this in 74b2e07 Jan 31, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.