Source file test/typeparam/issue54497.go

     1  // errorcheck -0 -m
     2  
     3  // Copyright 2022 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  // Test that inlining works with generic functions.
     8  
     9  package testcase
    10  
    11  type C interface{ ~uint | ~uint32 | ~uint64 }
    12  
    13  func isAligned[T C](x, y T) bool { // ERROR "can inline isAligned\[uint\]" "can inline isAligned\[go\.shape\.uint\]" "inlining call to isAligned\[go\.shape\.uint\]"
    14  	return x%y == 0
    15  }
    16  
    17  func foo(x uint) bool { // ERROR "can inline foo"
    18  	return isAligned(x, 64) // ERROR "inlining call to isAligned\[go\.shape\.uint\]"
    19  }
    20  

View as plain text