changeset 807:1fc6c4daec44 refactor/sbp_operators_method_signatures

Add type parameter to Vararg to make better error messages when Stencil is called with incompatible weights such as (1,1.,1)
author Jonatan Werpers <jonatan@werpers.com>
date Sat, 18 Sep 2021 23:30:49 +0200
parents 9fc6d38da03f
children 9479c03f413b a4d7ca5de3c6
files src/SbpOperators/stencil.jl
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/SbpOperators/stencil.jl	Wed Sep 15 22:09:23 2021 +0200
+++ b/src/SbpOperators/stencil.jl	Sat Sep 18 23:30:49 2021 +0200
@@ -15,7 +15,7 @@
 
 Create a stencil with the given weights with element `center` as the center of the stencil.
 """
-function Stencil(weights::Vararg; center::Int)
+function Stencil(weights::Vararg{T}; center::Int) where T # Type parameter T makes sure the weights are valid for the Stencil constuctors and throws an earlier, more readable, error
     N = length(weights)
     range = (1, N) .- center