From 77c093db48e15887863f70d1217df6006d077ed1 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Fri, 9 Apr 2021 10:23:16 +0200 Subject: [PATCH] Update erasedValue docs in inline.md Fixes #12034 --- docs/docs/reference/metaprogramming/inline.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/docs/reference/metaprogramming/inline.md b/docs/docs/reference/metaprogramming/inline.md index 8fca067daf51..d5b1ce680bb9 100644 --- a/docs/docs/reference/metaprogramming/inline.md +++ b/docs/docs/reference/metaprogramming/inline.md @@ -408,13 +408,12 @@ We can already express this using rewrite match expressions and a simple helper function, `scala.compiletime.erasedValue`, which is defined as follows: ```scala -erased def erasedValue[T]: T = ??? +def erasedValue[T]: T ``` -The `erasedValue` function _pretends_ to return a value of its type argument -`T`. In fact, it would always raise a `NotImplementedError` exception when -called. But the function can in fact never be called, since it is declared -`erased`, so can only be used at compile-time during type checking. +The `erasedValue` function _pretends_ to return a value of its type argument `T`. +Calling this function will always result in a compiletime error unless the call +is removed from the code while inlining. Using `erasedValue`, we can then define `defaultValue` as follows: