Skip to content

Commit e7cbbd6

Browse files
authored
Merge pull request #13883 from dotty-staging/set-untyped-to-nothing
Change Untyped from Null to Nothing for Trees
2 parents 483bf2c + fe959ee commit e7cbbd6

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ import Decorators._
1919

2020
object Trees {
2121

22-
// Note: it would be more logical to make Untyped = Nothing.
23-
// However, this interacts in a bad way with Scala's current type inference.
24-
// In fact, we cannot write something like Select(pre, name), where pre is
25-
// of type Tree[Nothing]; type inference will treat the Nothing as an uninstantiated
26-
// value and will not infer Nothing as the type parameter for Select.
27-
// We should come back to this issue once type inference is changed.
28-
type Untyped = Null
22+
type Untyped = Nothing
2923

3024
/** The total number of created tree nodes, maintained if Stats.enabled */
3125
@sharable var ntrees: Int = 0
@@ -44,8 +38,7 @@ object Trees {
4438
*
4539
* - You can never observe a `tpe` which is `null` (throws an exception)
4640
* - So when creating a typed tree with `withType` we can re-use
47-
* the existing tree transparently, assigning its `tpe` field,
48-
* provided it was `null` before.
41+
* the existing tree transparently, assigning its `tpe` field.
4942
* - It is impossible to embed untyped trees in typed ones.
5043
* - Typed trees can be embedded in untyped ones provided they are rooted
5144
* in a TypedSplice node.

0 commit comments

Comments
 (0)