<commit_before>discard """
  output: '''(x: 'a')'''
"""

type
  Bar[T] = object
    x: T

proc infer(T: typeDesc): Bar[T] = Bar[T](x: 'a')

let foo = infer(char)
echo foo

when true:
  # bug #1783

  type
      uoffset_t* = uint32
      FlatBufferBuilder* = object

      Array* [T] = object
          o*: uoffset_t
          len*: int
          data*: ptr UncheckedArray[T]

  proc ca* (fbb: ptr FlatBufferBuilder, T: typedesc, len: int): Array[T] {.noinit.} =
      result.len = len

  var fbb: ptr FlatBufferBuilder
  let boolarray = ca(fbb, bool, 2)
  let boolarray2 = fbb.ca(bool, 2)

# bug #1664
type Point[T] = tuple[x, y: T]
proc origin(T: typedesc): Point[T] = discard
discard origin(int)

# https://github.com/nim-lang/Nim/issues/7516
import typetraits

proc hasDefault1(T: type = int): auto = return T.name
doAssert hasDefault1(int) == "int"
doAssert hasDefault1(string) == "string"
doAssert hasDefault1() == "int"

proc hasDefault2(T = string): auto = return T.name
doAssert hasDefault2(int) == "int"
doAssert hasDefault2(string) == "string"
doAssert hasDefault2() == "string"


# bug #9195
type
  Error = enum
    erA, erB, erC
  Result[T, U] = object
    x: T<commit_msg>close #12704 by adding a test (tuple codegen error) (#13592)<commit_after>discard """
  output: '''(x: 'a')'''
"""

type
  Bar[T] = object
    x: T

proc infer(T: typeDesc): Bar[T] = Bar[T](x: 'a')

let foo = infer(char)
echo foo

when true:
  # bug #1783

  type
      uoffset_t* = uint32
      FlatBufferBuilder* = object

      Array* [T] = object
          o*: uoffset_t
          len*: int
          data*: ptr UncheckedArray[T]

  proc ca* (fbb: ptr FlatBufferBuilder, T: typedesc, len: int): Array[T] {.noinit.} =
      result.len = len

  var fbb: ptr FlatBufferBuilder
  let boolarray = ca(fbb, bool, 2)
  let boolarray2 = fbb.ca(bool, 2)

# bug #1664
type Point[T] = tuple[x, y: T]
proc origin(T: typedesc): Point[T] = discard
discard origin(int)

block: # issue #12704
  const a = $("a", "b")
  proc fun() =
    const str = $int
    let b = $(str, "asdf")
  fun()

# https://github.com/nim-lang/Nim/issues/7516
import typetraits

block: #issue #12704
  const a = $("a", "b")
  proc fun() =
    const str = name(int)
    let b = $(str, "asdf")
  fun()

proc hasDefault1(T: type = int): auto = return T.name
doAssert hasDefault1(int) == "int"
doAssert hasDefault1(string) == "string"
doAssert hasDefault1() == "int"

proc hasDefault2(T = string): auto = return T.name
doAssert hasDefault2(int) == "int"
doAssert hasDefault2(string) == "string"
doAssert hasDefault2() == "string"


# bug #9195
type
  Error = enum
    erA, erB, erC
  Result[T, U] = object
    x: T
{'fraction_non_alphanumeric': 0.1554384644335717, 'fraction_numerical': 0.029356417011667295, 'mean_word_length': 3.2801932367149758, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7633931', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1006, 'n_words': 294}