Error compiling @differentiable computed property (within a struct) if defined in a different file from its use site. #63169
Labels
accessors
Feature → declarations: Variable (property) accessors
AutoDiff
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
multiple files
Flag: An issue whose reproduction requires multiple files
type checker
Area → compiler: Semantic analysis
unexpected error
Bug: Unexpected error
Description
If we have a struct containing a @differentiable computed property (with explicit get/set directives) in the same file that it is used, then the program compiles successfully. However, If this struct is in a different file, the compilation fails. The error message is as follows:
Steps to reproduce
This reproducer requires two Swift files, in the same directory (for example, insides Sources/ProjectName).
File 1:
File 2:
Place the above code into two separate files, and compile in Debug mode.
Note: Placing
TestStruct
insideFile 1
, albeit outsideMyReproducer
, will cause the compilation to succeed.Expected behavior
The project containing the two files should compile successfully, even when
TestStruct
andMyReproducer
are in different files.Additional context
Similar to: #55170
The text was updated successfully, but these errors were encountered: