Skip to content

Commit 85a03ee

Browse files
Merge pull request #12037 from dotty-staging/fix-#12034
Update `erasedValue` docs in inline.md
2 parents f09da52 + 77c093d commit 85a03ee

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

docs/docs/reference/metaprogramming/inline.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,12 @@ We can already express this using rewrite match expressions and a simple
408408
helper function, `scala.compiletime.erasedValue`, which is defined as follows:
409409

410410
```scala
411-
erased def erasedValue[T]: T = ???
411+
def erasedValue[T]: T
412412
```
413413

414-
The `erasedValue` function _pretends_ to return a value of its type argument
415-
`T`. In fact, it would always raise a `NotImplementedError` exception when
416-
called. But the function can in fact never be called, since it is declared
417-
`erased`, so can only be used at compile-time during type checking.
414+
The `erasedValue` function _pretends_ to return a value of its type argument `T`.
415+
Calling this function will always result in a compiletime error unless the call
416+
is removed from the code while inlining.
418417

419418
Using `erasedValue`, we can then define `defaultValue` as follows:
420419

0 commit comments

Comments
 (0)