Skip to content

Different type sizes for TupleN vs nested pairs encoding #24730

@mbovel

Description

@mbovel
package dotty.tools.dotc.core

import dotty.tools.DottyTest
import dotty.tools.dotc.core.Symbols.defn
import dotty.tools.dotc.core.TypeOps

import org.junit.Test
import org.junit.Assert.assertEquals

class TypesTest extends DottyTest:

  @Test def tuple3TypeSize =
    val tpe = defn.TupleType(3).nn.appliedTo(List(defn.IntType, defn.BooleanType, defn.DoubleType))
    assertEquals(3, tpe.typeSize) // false,  tpe.typeSize == 1 🤔

  @Test def tuple3ConsTypeSize =
    val tpe = TypeOps.nestedPairs(List(defn.IntType, defn.BooleanType, defn.DoubleType))
    assertEquals(3, tpe.typeSize)

Shouldn't the size of a 3-tuple always be 3, whereas it is encoded with a Tuple3 type application or with nested pairs?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions