mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Support conversion between integer types. (#6856)
Add an `IntFitsIn` interface with a custom witness, such that `T impls
IntFitsIn(U)` if `T` is an integer type all of whose values fit
losslessly into the integer type `U`. Use it to constrain implicit
conversions between integer types.
So far, this has not been extended to the
`CppCompat.[U]{Long32,LongLong64}` types, only to `Core.Int(N)` and
`Core.UInt(N)`.
Assisted-by: Gemini 3 Pro via Antigravity
This commit is contained in:
@@ -113,16 +113,16 @@ fn VectorizedWithOptSpeed(a: array(i32, 65536)*) {
|
||||
// CHECK:STDOUT: !21 = !DILocalVariable(arg: 1, scope: !16, type: !19)
|
||||
// CHECK:STDOUT: !22 = !DILocation(line: 18, column: 9, scope: !16)
|
||||
// CHECK:STDOUT: !23 = !DILocation(line: 19, column: 5, scope: !16)
|
||||
// CHECK:STDOUT: !24 = !DILocation(line: 277, column: 3, scope: !25, inlinedAt: !32)
|
||||
// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.Int.9452f4c51951679b.Core:AddAssignWith.5375cfcbca6d9e35.Core.75bec4d236c9daa5", scope: null, file: !26, line: 277, type: !27, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !29)
|
||||
// CHECK:STDOUT: !24 = !DILocation(line: 296, column: 3, scope: !25, inlinedAt: !32)
|
||||
// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.Int.9452f4c51951679b.Core:AddAssignWith.5375cfcbca6d9e35.Core.57ee91777b6354a8", scope: null, file: !26, line: 296, type: !27, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !29)
|
||||
// CHECK:STDOUT: !26 = !DIFile(filename: "{{.*}}/prelude/types/int.carbon", directory: "")
|
||||
// CHECK:STDOUT: !27 = !DISubroutineType(types: !28)
|
||||
// CHECK:STDOUT: !28 = !{null, !7, !7}
|
||||
// CHECK:STDOUT: !29 = !{!30, !31}
|
||||
// CHECK:STDOUT: !30 = !DILocalVariable(arg: 1, scope: !25, type: !7)
|
||||
// CHECK:STDOUT: !31 = !DILocalVariable(arg: 2, scope: !25, type: !7)
|
||||
// CHECK:STDOUT: !32 = distinct !DILocation(line: 343, column: 5, scope: !33, inlinedAt: !38)
|
||||
// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "Op", linkageName: "_COp.Int.9452f4c51951679b.Core:Inc.Core.be1e879c1ad406d8", scope: null, file: !26, line: 341, type: !34, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !36)
|
||||
// CHECK:STDOUT: !32 = distinct !DILocation(line: 362, column: 5, scope: !33, inlinedAt: !38)
|
||||
// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "Op", linkageName: "_COp.Int.9452f4c51951679b.Core:Inc.Core.be1e879c1ad406d8", scope: null, file: !26, line: 360, type: !34, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !36)
|
||||
// CHECK:STDOUT: !34 = !DISubroutineType(types: !35)
|
||||
// CHECK:STDOUT: !35 = !{null, !7}
|
||||
// CHECK:STDOUT: !36 = !{!37}
|
||||
|
||||
Reference in New Issue
Block a user