diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-04 22:59:43 -0700 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-04 22:59:43 -0700 |
commit | e1f8bc965bbf0c66cf372f5c81295a4c12fafc7d (patch) | |
tree | 5566958c5e5e2b3a88179b3ef99b967c2d4d074b /core | |
parent | 00cb7f42aafc2d76d9161ec2f288cef6dd63737e (diff) | |
download | mill-e1f8bc965bbf0c66cf372f5c81295a4c12fafc7d.tar.gz mill-e1f8bc965bbf0c66cf372f5c81295a4c12fafc7d.tar.bz2 mill-e1f8bc965bbf0c66cf372f5c81295a4c12fafc7d.zip |
add another negative test to ensure we give good error messages when trying to apply() a value coming from inside a T{...} block, this time as the param of a lambda
Diffstat (limited to 'core')
-rw-r--r-- | core/src/test/scala/forge/CacherTests.scala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/src/test/scala/forge/CacherTests.scala b/core/src/test/scala/forge/CacherTests.scala index d77287ac..11ecdfce 100644 --- a/core/src/test/scala/forge/CacherTests.scala +++ b/core/src/test/scala/forge/CacherTests.scala @@ -83,6 +83,21 @@ object CacherTests extends TestSuite{ }""") assert(err.msg == expectedMsg) } + 'neg2 - { + + val expectedMsg = + "Target#apply() call cannot use `value x` defined within the T{...} block" + val err = compileError("""{ + val a = T{ 1 } + val arr = Array(a) + val b = { + T{ + arr.map{x => x()} + } + } + }""") + assert(err.msg == expectedMsg) + } } } } |