Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement minimal support for generic buffers #1571

Merged
merged 33 commits into from
Sep 1, 2024
Merged

Conversation

kyouko-taiga
Copy link
Contributor

This PR lets us write this:

public fun main() {
  let x = Array([1, 2, 3])
  print(x[0])
}

The Array constructor used in this program has the following signature:

public init<n: Int>(_ elements: sink Element[n])

n is a generic value parameter that determines the size of the buffer taken as argument. In the example, inference is able to deduce the value of this parameter from the size of the buffer.

Copy link

codecov bot commented Aug 26, 2024

Codecov Report

Attention: Patch coverage is 87.47300% with 58 lines in your changes missing coverage. Please review.

Project coverage is 88.24%. Comparing base (4d264ce) to head (22a95a4).
Report is 34 commits behind head on main.

Files with missing lines Patch % Lines
...ources/FrontEnd/TypeChecking/SubstitutionMap.swift 81.48% 15 Missing ⚠️
...urces/FrontEnd/TypeChecking/ConstraintSystem.swift 86.66% 14 Missing ⚠️
Sources/FrontEnd/TypeChecking/TypeChecker.swift 91.40% 11 Missing ⚠️
Sources/FrontEnd/TypeChecking/Solution.swift 55.55% 4 Missing ⚠️
Sources/FrontEnd/Terms/TermVariable.swift 50.00% 3 Missing ⚠️
Sources/FrontEnd/Terms/AnyTerm.swift 91.30% 2 Missing ⚠️
Sources/FrontEnd/Terms/ErrorTerm.swift 0.00% 2 Missing ⚠️
Sources/FrontEnd/Terms/TermProtocol.swift 81.81% 2 Missing ⚠️
Sources/FrontEnd/Terms/ConcreteTerm.swift 75.00% 1 Missing ⚠️
Sources/FrontEnd/Terms/GenericTermParameter.swift 80.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1571      +/-   ##
==========================================
+ Coverage   88.18%   88.24%   +0.06%     
==========================================
  Files         374      380       +6     
  Lines       22709    22801      +92     
==========================================
+ Hits        20025    20121      +96     
+ Misses       2684     2680       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This commit introduces `AnyTerm`, which mirrors `AnyType`.
@kyouko-taiga kyouko-taiga marked this pull request as ready for review September 1, 2024 18:52
@kyouko-taiga kyouko-taiga merged commit 3a30da5 into main Sep 1, 2024
15 of 16 checks passed
@kyouko-taiga kyouko-taiga deleted the array-buffer-init branch September 1, 2024 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant