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

Compiler flags for literal types? #12

Open
davegurnell opened this issue Nov 1, 2016 · 7 comments
Open

Compiler flags for literal types? #12

davegurnell opened this issue Nov 1, 2016 · 7 comments

Comments

@davegurnell
Copy link
Collaborator

Reported by @d6y:

Box on "Literal types in Scala", p. 56

There's a flag to enable this stuff, right? Worth saying that?

As of Lightbend Scala....., with the -wibble flag enabled, we now have direct syntax support...

@metasim
Copy link

metasim commented Sep 7, 2017

The example

val theAnswer: 42 = 42

does not work in (non-Typelevel) Scala 2.11.11 nor 2.12.3.

scala> val theAnswer: 42 = 42
<console>:1: error: identifier expected but integer literal found.
       val theAnswer: 42 = 42
                      ^

According to the callout on p56 it should, right?

@davegurnell
Copy link
Collaborator Author

davegurnell commented Sep 8, 2017 via email

@metasim
Copy link

metasim commented Sep 8, 2017

When I posted that I was looking at the PDF version at work. At home I have the paperback version, and noted there that it does reference the -Yliteral-types flag. So it looks like the Lulu version is more up to date than the free PDF version.

All that said, this is what I'm getting with 2.12.3:

sfitch$ scalac -version
Scala compiler version 2.12.3 -- Copyright 2002-2017, LAMP/EPFL and Lightbend, Inc.
sfitch$ scalac -Yliteral-types
scalac error: bad option: '-Yliteral-types'
  scalac -help  gives more information

@davegurnell
Copy link
Collaborator Author

davegurnell commented Sep 8, 2017 via email

@metasim
Copy link

metasim commented Sep 8, 2017

Nope:

sfitch$ scala -version
Scala code runner version 2.12.3 -- Copyright 2002-2017, LAMP/EPFL and Lightbend, Inc.

sfitch$ scala -Yliteral-types
bad option: '-Yliteral-types'

Usage: scala <options> [<script|class|object|jar> <arguments>]
   or  scala -help

All options to scalac (see scalac -help) are also allowed.

sfitch$ scala
Welcome to Scala 2.12.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_121).
Type in expressions for evaluation. Or try :help.

scala> val theAnswer: 42 = 42
<console>:1: error: identifier expected but integer literal found.
       val theAnswer: 42 = 42
                      ^

@d6y
Copy link
Contributor

d6y commented Sep 15, 2017

Update on this: it looks like the PR for literal types isn't yet merged into Lightbend Scala. Probably worth updating the text to say "...and coming soon in Lightbend Scala".

@davegurnell
Copy link
Collaborator Author

davegurnell commented Sep 17, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants