Skip to content

Commit

Permalink
Add literal-based singleton types (SIP-23).
Browse files Browse the repository at this point in the history
Only the parser needed to be updated. Everything else works out of the box.
  • Loading branch information
odersky committed Aug 23, 2015
1 parent fc979d9 commit c0001fb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -709,12 +709,14 @@ object Parsers {
* | Path `.' type
* | `(' ArgTypes `)'
* | Refinement
* | Literal
*/
def simpleType(): Tree = simpleTypeRest {
if (in.token == LPAREN)
atPos(in.offset) { makeTupleOrParens(inParens(argTypes())) }
else if (in.token == LBRACE)
atPos(in.offset) { RefinedTypeTree(EmptyTree, refinement()) }
else if (isLiteral) { SingletonTypeTree(literal()) }
else path(thisOK = false, handleSingletonType) match {
case r @ SingletonTypeTree(_) => r
case r => convertToTypeId(r)
Expand Down

0 comments on commit c0001fb

Please sign in to comment.