Skip to content

Commit 11794d3

Browse files
stepanchegfacebook-github-bot
authored andcommitted
Fix .type for function
Summary: Do not return `None` from `.type` when type name is not known. Reviewed By: JakobDegen Differential Revision: D63708443 fbshipit-source-id: ed8f15f732c8eaf58aebbd56a2667a484f0cbcb5
1 parent 36d2e67 commit 11794d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

starlark/src/values/types/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'v> StarlarkValue<'v> for NativeFunction {
171171
}
172172

173173
fn get_attr(&self, attribute: &str, heap: &'v Heap) -> Option<Value<'v>> {
174-
if let Some(s) = self.as_type.as_ref().map(|t| t.as_name()) {
174+
if let Some(s) = self.as_type.as_ref().and_then(|t| t.as_name()) {
175175
if attribute == "type" {
176176
return Some(heap.alloc(s));
177177
}

0 commit comments

Comments
 (0)