<commit_before>// RUN: rm -rf %t && mkdir -p %t
// RUN: %target-build-swift -O  %s -o %t/a.out
// RUN: %target-run %t/a.out | FileCheck %s -check-prefix=CHECK-OUTPUT
// REQUIRES: executable_test

// Check that in optimized builds the compiler generates correct code for
// initializations of let properties, which is assigned multiple times inside
// initializers.

public class Foo1 {
  internal let Prop1: Int32
  internal let Prop2: Int32
  // Initialize Prop3 as part of declaration.
  internal let Prop3: Int32 = 20
  internal let Prop4: Int32

  @inline(never)
  init(_ count: Int32) {
    // Intialize Prop4 unconditionally and only once.
    Prop4 = 300
    // There are two different assignments to Prop1 and Prop2
    // on different branchs of the if-statement.
    if count < 2 {
      // Initialize Prop1 and Prop2 conditionally.
      // Use other properties in the definition of Prop1 and Prop2.
      Prop1 = 5
      Prop2 = 10 - Prop1 + Prop4 - Prop3
    } else {
       // Initialize Prop1 and Prop2 conditionally.
      // Use other properties in the definition of Prop1 and Prop2.
      Prop1 = 100
      Prop2 = 200 + Prop1 - Prop4 - Prop3
    }
  }
}

public func testClassLet(f: Foo1) -> Int32 {
  return f.Prop1 + f.Prop2 + f.Prop3 + f.Prop4
}

// Prop1 = 5, Prop2 = (10-5+300-20) = 285, Prop3 = 20, Prop4 = 300
// Hence Prop1 + Prop2 + Prop3 + Prop4 = 610
// CHECK-OUTPUT: 610
print(testClassLet(Foo1(1)))<commit_msg>[gardening] Fix recently introduced typo: "intialize" → "initialize"<commit_after>// RUN: rm -rf %t && mkdir -p %t
// RUN: %target-build-swift -O  %s -o %t/a.out
// RUN: %target-run %t/a.out | FileCheck %s -check-prefix=CHECK-OUTPUT
// REQUIRES: executable_test

// Check that in optimized builds the compiler generates correct code for
// initializations of let properties, which is assigned multiple times inside
// initializers.

public class Foo1 {
  internal let Prop1: Int32
  internal let Prop2: Int32
  // Initialize Prop3 as part of declaration.
  internal let Prop3: Int32 = 20
  internal let Prop4: Int32

  @inline(never)
  init(_ count: Int32) {
    // Initialize Prop4 unconditionally and only once.
    Prop4 = 300
    // There are two different assignments to Prop1 and Prop2
    // on different branchs of the if-statement.
    if count < 2 {
      // Initialize Prop1 and Prop2 conditionally.
      // Use other properties in the definition of Prop1 and Prop2.
      Prop1 = 5
      Prop2 = 10 - Prop1 + Prop4 - Prop3
    } else {
       // Initialize Prop1 and Prop2 conditionally.
      // Use other properties in the definition of Prop1 and Prop2.
      Prop1 = 100
      Prop2 = 200 + Prop1 - Prop4 - Prop3
    }
  }
}

public func testClassLet(f: Foo1) -> Int32 {
  return f.Prop1 + f.Prop2 + f.Prop3 + f.Prop4
}

// Prop1 = 5, Prop2 = (10-5+300-20) = 285, Prop3 = 20, Prop4 = 300
// Hence Prop1 + Prop2 + Prop3 + Prop4 = 610
// CHECK-OUTPUT: 610
print(testClassLet(Foo1(1)))
{'fraction_non_alphanumeric': 0.10408163265306122, 'fraction_numerical': 0.06326530612244897, 'mean_word_length': 2.6488833746898264, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '2008088', 'n_tokens_mistral': 1042, 'n_tokens_neox': 939, 'n_words': 352}