From 8297843765c7195bb7c3ad30e91de6779b9bff99 Mon Sep 17 00:00:00 2001 From: James Iry Date: Wed, 23 Jan 2013 11:57:06 -0800 Subject: SI-6434 Pretty print function types with by name arg as (=> A) => B We were pretty printing a function type with one by name arg as => A => B, but because => is right associative that's formally equivalent to => (A => B) and that's entirely a different thing. This commit changes the pretty printer in Typers.scala to check for a byname argument on a function type and wrap it in parens. A REPL test is included. --- test/files/run/t6434.check | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/files/run/t6434.check (limited to 'test/files/run/t6434.check') diff --git a/test/files/run/t6434.check b/test/files/run/t6434.check new file mode 100644 index 0000000000..f898b6b781 --- /dev/null +++ b/test/files/run/t6434.check @@ -0,0 +1,10 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> def f(x: => Int): Int = x +f: (x: => Int)Int + +scala> f _ +res0: (=> Int) => Int = + +scala> -- cgit v1.2.3