Status/Resolution/Reason: Closed/Fixed/Fixed
Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)
Created: 05/13/2013
Components: Language
Versions: 2016,11.0,10.0,2018
Failure Type:
Found In Build/Fixed In Build: Final / CF 2018 Final Build
Priority/Frequency: Normal / Few users will encounter
Locale/System: English / Win XP All
Vote Count: 0
Extracted from http://adamcameroncoldfusion.blogspot.co.uk/2013/05/interface-inheritance-what-one-can-and.html
[...] I think when there's situations in which the type "any" is specified in an interface, then any sort of return type / argument type should be allowed. For example:
// I.cfc
interface {
any function returnsAny();
void function takesAny(required any x);
}
// ReturnsString.cfc
component implements= "I" {
string function returnsAny(){
return "G'day world" ;
}
void function takesAny (required any x){
}
}
// PassesString.cfc
component implements= "I" {
any function returnsAny(){
return "G'day world" ;
}
void function takesAny(required string x){
}
}
// PassesString.cfc
component implements= "I" {
any function returnsAny(){
return "G'day world" ;
}
void function takesAny(required string x){
}
}
If I run test.cfm, I get this output:
Return type mismatch. The returnsAny function does not specify the same return type in the ReturnsString ColdFusion component and the I ColdFusion interface.
Data type mismatch. The takesAny function does not specify the same data type for the x argument in the PassesString ColdFusion component and the I ColdFusion interface.
So CF is very literal here when it comes to what "any" is. As I indicated, I get why it's like this, but I don't think it should be.
I've flagged this as CF10, but it obviously affects CF's interface implementation from the outset to the current day.
--
Adam
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3558899
External Customer Info:
External Company:
External Customer Name: Adam Cameron.
External Customer Email:
External Test Config: My Hardware and Environment details:
Attachments:
Comments: