我的验证环境中有下一个代码:
// seq_file.e
extend SPECIFIC_TYPE sequence {
keep type driver is a SPECIFIC_TYPE sequence_driver;
event some_event is @driver.as_a(SPECIFIC_TYPE sequence_driver).some_event;
};
extend SPECIFIC_TYPE SEQ_NAME sequence {
body()@driver.clock is only {
var foo := driver.specific_type_field;
};
};
请注意,感谢keep type driver is a..
,driver
的强制转换无需放在var foo..
开头的行中
但,keep type driver is a..
不会影响some_event
,即,如果从行中删除as_a
强制转换,则会出现编译错误,{ {1}}。
为什么'driver' does not have 'some_event' though its subtype do. use driver.as_a(SPECIFIC_TYPE sequence_driver)
无法在keep type driver is a..
行中投射driver
?
谢谢您的帮助
答案 0 :(得分:1)
您的观察是正确的:对于字段访问(对于方法调用),类型约束被考虑在内,但对于事件采样,则没有考虑。这是一个限制,在以后的版本中可能会删除它。我建议联系Specman官方支持以获取有关计划的确切信息。